Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Currently in the output for NetKAN pull request validation, the download URLs are printed with spaces unescaped:
This trips up the Jenkins site's attempt to make the URLs clickable, which could be handy if someone investigating an issue wants to inspect the downloaded files locally. Only the part leading up to the first space is detected, which isn't the full URL that's being downloaded.
Changes
Now we replace spaces in this output with
%20
as per standard URL encoding.I looked into the proper functions for encoding URLs in C#, and none of them seemed appropriate for this. The problem is that
Uri.ToString()
outputs a partially valid URL (correctly formatted but may contain spaces), which none of the various encoding functions expect. Some of them would encode the://
part as%3A%2F%2F
, which we definitely don't want, and the rest would miss the spaces. So I just went with.Replace
.This change affects only these specific output statements; no changes are made to the internals of URL handling for downloads, metadata, etc.
Trivia
You may be familiar with the practice of encoding spaces in URLs as
+
. TIL that this is only valid in the keys and values of form fields, but not in the base URL to which those keys and values are sent (or anywhere in non-form URLs)! This is why I went with%20
in this case.