[Bug 448044] Problem with apostrophe in URL

gnome-terminal (GNOME Bugzilla) bugzilla at gnome.org
Mon Dec 18 08:46:09 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=448044

--- Comment #8 from Egmont Koblinger <egmont at gmail.com> ---
Created attachment 365673
  --> https://bugzilla.gnome.org/attachment.cgi?id=365673&action=edit
v0

Here's a draft patch that seems to be working.

It's based on the 3rd approach. At the beginning there's a named capturing
group APOS_START with a lookbehind to see whether there's a leading apostrophe.
The whole thing is made optional because we mustn't bail out if there isn't.

At the end, lookbehind + backtracking cannot work because backtracking works on
the level of regex blocks, not individual characters. A single backtracking
step decides to omit the whole optional URLPATH. Maybe the regex could be
reworked so that it works, but doesn't look easy.

Instead, luckily, we already define a different set of characters that can
terminate the path (to exclude dot and comma, and I even sneaked in semicolon
here yesterday). The path needs to end in one like this, unless it ends in a
closing parentheseis or square bracket (or is empty), in which case we don't
care about apostrophe here at all.

So here we branch on whether the optional opening apostrophe's named capturing
group matched or not, and depending on that, we forbid or allow the apostrophe.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-gnome-maintainers/attachments/20171218/6d9fd3db/attachment-0001.html>


More information about the pkg-gnome-maintainers mailing list