ezyang / ezyang/htmlpurifier

UNC path with Backslash character don't work

Open
#407 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.4k
Forks
361
Avg merge
3d 41m
Merged PRs (30d)
2

Description

Hello,

Background

I am using HTML Purifier to handle URI validation.
But I get a problem when using it file file protocol.
It won't work with my case: file:\\\Users\thanh-le\Downloads\my-folder

Cause

The backslash character (\) will be encode by HTMLPurifier_PercentEncoder

Suggest Solution

Ignore backslash when doing percent encode by adding backslash character here: https://github.com/ezyang/htmlpurifier/blob/d9fbef8e27f6a0848a8987a8534351de98eb0fa1/library/HTMLPurifier/URI.php

How to you think about this issue?
Thank you so much.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in library/HTMLPurifier/URI.php, especially the HTMLPurifier_PercentEncoder handling described in the issue. Reproduce validation of the supplied UNC file URI and verify whether backslashes are preserved during percent encoding. Done means the UNC path works without regressing URI validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.