Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users/kej/handlebackslashproperly #6288

Merged
merged 3 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Tasks/cURLUploader/curluploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ async function run() {
// Now we get a list of all files under this root
var allFiles = tl.find(findPathRoot);

// IMPORTANT: The backslash character is a valid character in linux style directory and file names. However, as
// this is a file pattern not a file path we are converting all backslashes to forward slashes.
filesPattern = filesPattern.replace(/\\/g, '/');

// Now matching the pattern against all files
var uploadFilesList = tl.match(allFiles, filesPattern, undefined, {matchBase: true});
var uploadFilesList = tl.match(allFiles, filesPattern, undefined, {matchBase: true}).map( (s) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment on why we had to do this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. Thanks!

// If running on Windows agent, normalize the Windows style file paths to use '/' rather than '\'.
// If running on Linux or macOS, escape any '\' in filenames. This is necessary as curl.exe treats
// '\' in filenames as escape characters, preventing it from finding those files.
return isWin ? s.replace(/\\/g, '/') : s.replace(/\\/g, '\\\\');
});

// Fail if no matching app files were found
if (!uploadFilesList || uploadFilesList.length == 0) {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/cURLUploader/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 127,
"Minor": 130,
"Patch": 0
},
"runsOn": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/cURLUploader/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 127,
"Minor": 130,
"Patch": 0
},
"runsOn": [
Expand Down