mate-desktop / engrampa

A file archiver for MATE
http://www.mate-desktop.org
GNU General Public License v2.0
113 stars 52 forks source link

Replace special "#" and "?" characters in uri #503

Closed zhuyaliang closed 10 months ago

zhuyaliang commented 11 months ago

Fix #501

zhuyaliang commented 11 months ago

@cwendling Do you accept the repair method?

cwendling commented 11 months ago

Does this actually fix the issue, even for a file named foo#bar? Can't you use g_uri_escape_string() which should be more robust?

zhuyaliang commented 11 months ago

@cwendling I confirm that the issue has been fixed. The problem only occurs when the first character in the string is a special character,I use g_uri_escape_string (name, G_URI_RESERVED_CHARS_GENERIC_DELIMITERS, FALSE) failed to solve the issue

zhuyaliang commented 11 months ago

Can you tell me the correct usage of g_uri_escape string?

zhuyaliang commented 11 months ago

Does this actually fix the issue, even for a file named foo#bar?

It is indeed possible to handle this format of file, although it does not block, the result is abnormal

cwendling commented 11 months ago

g_uri_escape string(name, NULL, TRUE) Passing G_URI_RESERVED_CHARS_GENERIC_DELIMITERS as reserved_chars_allowed defeats the purpose, as it will not escape the characters that are the most important to escape :)

cwendling commented 11 months ago

Looks generally better (and possibly OK).

This should be tested with all kind of file names including %, ? and # in them, if possible in all possible usage scenario of these functions, yet I'm not sure yet which code paths lead to calling of those functions.

zhuyaliang commented 10 months ago

@cwendling Can we merge?

cwendling commented 10 months ago

I actually took the liberty of pushing my suggested changes to the branch so others can test easier; feel free to revert to 10b0bbb9e76c24baaa3ae8639fa80dba8a6fba75 and tell me if you don't like me doing this.

cwendling commented 10 months ago

…and rebased on top of 40fbfca42d7166c05e55797e73431ef7de46173b to hopefully get a green build :)