Repository navigation
Use urlEncode to handle spaces in file names, closes #432 - #434
ericwooley wants to merge 3 commits into
Conversation
|
I added files in the test fixture that has spaces in them. Which broke the tests, then fixed them. Hopefully that is enough test coverage. |
| // Map files to original and urlEncoded | ||
| .map(function (file) { | ||
| return { | ||
| encodedString: encodeURIComponent(file), |
There was a problem hiding this comment.
Whoa, git am supports URL encoded filenames? Nice find!
| // Remove all url encoded file names from patch | ||
| patch = filesInPatch.reduce(function (partiallyReplacedPatch, file) { | ||
| return partiallyReplacedPatch.replace(new RegExp(file.encodedString, "mg"), file.originalString); | ||
| }, patch); |
There was a problem hiding this comment.
Oh! I see, you're un-doing the URL encoding.
I like this solution. Much nicer than trying to make a regex that handles the spaces!
There was a problem hiding this comment.
Thanks! Yea, I could not find a reasonable way at all to do regex.
However this is still running into other problems I have yet to figure out on the larger repos.
I am using git subtree to import them, and it seems to have worked really well. I'm still trying to figure out if it worked correctly in terms of commit history.
|
|
||
| // Replace all file names with url encoded file names | ||
| patch = filesInPatch.reduce(function (partiallyReplacedPatch, file) { | ||
| return partiallyReplacedPatch.replace(new RegExp(file.originalString, "mg"), file.encodedString); |
There was a problem hiding this comment.
Is there any danger here of regex meta characters in a filename messing up the match?
Or will the URL encoding take care of that?
|
It seems like maybe this should be closed? It's been open for quite a while, and has since been conflicted. |
|
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
No description provided.