mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Previously, `prefetchFile()` used `baseNameOf()` directly on the URL string to extract the filename. This caused issues with URLs containing query parameters that include slashes, such as S3 URLs with custom endpoints: ``` s3://bucket/file.txt?endpoint=http://server:9000 ``` The `baseNameOf()` function naively searches for the rightmost `/` in the entire string, which would find the `/` in `http://server:9000` and extract `server:9000®ion=...` as the filename. This resulted in invalid store path names containing illegal characters like `:`. This commit fixes the issue by: 1. Adding a `VerbatimURL::lastPathSegment()` method that extracts the last non-empty path segment from a URL, using `pathSegments(true)` to filter empty segments 2. Changing `prefetchFile()` to accept `const VerbatimURL &` and use the new `lastPathSegment()` method instead of manual path parsing 3. Adding early validation with `checkName()` to fail quickly on invalid filenames 4. Maintains backward compatibility by falling back to `baseNameOf()` for unparsable `VerbatimURL`s |
||
|---|---|---|
| .. | ||
| external-api-docs | ||
| internal-api-docs | ||
| json-schema-checks | ||
| libcmd | ||
| libexpr | ||
| libexpr-c | ||
| libexpr-test-support | ||
| libexpr-tests | ||
| libfetchers | ||
| libfetchers-c | ||
| libfetchers-tests | ||
| libflake | ||
| libflake-c | ||
| libflake-tests | ||
| libmain | ||
| libmain-c | ||
| libstore | ||
| libstore-c | ||
| libstore-test-support | ||
| libstore-tests | ||
| libutil | ||
| libutil-c | ||
| libutil-test-support | ||
| libutil-tests | ||
| nix | ||
| perl | ||
| nix-functional-tests | ||
| nix-manual | ||