Branch: refs/heads/master
Home: https://github.com/openSUSE/open-build-service
Commit: 17eea85058e05ac5c55dca49f6e0dae4f1d8f13f
https://github.com/openSUSE/open-build-service/commit/17eea85058e05ac5c55dca...
Author: Lukas Krause
Date: 2022-04-21 (Thu, 21 Apr 2022)
Changed paths:
M src/api/app/models/package.rb
Log Message:
-----------
Escape whitespace characters correctly for filepaths
After the switch from ruby 2.5 to ruby 3.1 we switched from
`URI.escape` to `Addressable::URI.escape` in multiple places
(`URI` is deprecated).
Since anchors are valid parts of URIs, we started using `CGI.escape`
for filenames (see https://github.com/openSUSE/open-build-service/pull/12305#discussion_r826949...).
The problem is that whitespaces are treated differently by `CGI.escape`
compared to the previously used `URI.escape` (they are replaced by `+` signs instead
of using the percent encoding %20).
This clashes now, since files uploaded throught the API are still
'correctly' escaped.
Using `ERB::Util.url_encode` reintroduces the previous behaviour.
Example of the different escaping results:
```
2.5.0 :005 > URI.escape('TEST#123.diff')
=> "TEST%23123.diff"
2.5.0 :006 > URI.escape('TEST 123.diff')
=> "TEST%20123.diff"
[11] pry(main)> Addressable::URI.escape('TEST#123.diff')
=> "TEST#123.diff"
[12] pry(main)> Addressable::URI.escape('TEST 123.diff')
=> "TEST%20123.diff"
[13] pry(main)> ERB::Util.url_encode('TEST 123.diff')
=> "TEST%20123.diff"
[14] pry(main)> ERB::Util.url_encode('TEST#123.diff')
=> "TEST%23123.diff"
```
Fixes #12457
Commit: bf91fdff9f8e22b117899092de15b733b8d14b52
https://github.com/openSUSE/open-build-service/commit/bf91fdff9f8e22b1178990...
Author: Victor Pereira
Date: 2022-04-21 (Thu, 21 Apr 2022)
Changed paths:
M src/api/app/models/package.rb
Log Message:
-----------
Merge pull request #12466 from krauselukas/fix/issue_12457
Escape whitespace characters correctly for filepaths
Compare: https://github.com/openSUSE/open-build-service/compare/4e55a65af911...bf91fd...