Gitify icon indicating copy to clipboard operation
Gitify copied to clipboard

Strip file/path name (resource uri) for non alphanumeric characters

Open hansek opened this issue 10 years ago • 3 comments

There is a problem if resource alias contains not standard (alphanumeric) characters (e.g. prefix-“content”-suffix).

If this is stored to filesystem on windows it is different from state stored in GIT repo on some *nix machine.

Solution could be to strip all non alpha-numeric characters from file/directory name and to be name of file/directory unique, lets use suffix with resource ID.

Example: Resorce alias: prefix-“content”-suffix Filename: prefix-content-suffix--45 (where 45 is resource ID)


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

hansek avatar Jun 01 '15 13:06 hansek

Is it even valid to use quotes in a uri/alias? The file path for objects is cleaned through the modResource::filterPathSegment function in https://github.com/modmore/Gitify/blob/master/src/Command/ExtractCommand.php#L226, while it assumes the uri (alias) of the object was already cleaned up with that method when it was set...

Mark-H avatar Jun 12 '15 14:06 Mark-H

Maybe it's not valid, but nowadays you can have even utf-8 in URL (alias) and if you don't have clean (properly clean only for safe characters) alias in MODX you will get this alias as filename and problem is here.

Imho I think this functionality should be part of Gitify, because otherwise there could be a problem (i got into this situation few times) that extract command saves not clean filename (even with utf8 characters) with different characters depend on your OS (*nix vs. windows)

hansek avatar Jun 15 '15 06:06 hansek

+1

math-u avatar May 27 '16 18:05 math-u