Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
803b1e69d4 |
@@ -280,7 +280,7 @@ func sanitizePath(p string) (string, error) {
|
||||
func resolveManifestURL(inputURL string) (string, error) {
|
||||
parsed, err := url.Parse(inputURL)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to parse URL: %w", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Check if URL already ends with .mf
|
||||
|
||||
@@ -21,6 +21,10 @@ const (
|
||||
testFileTxt = "file.txt"
|
||||
testDirFile = "dir/file.txt"
|
||||
testIndexMF = "https://example.com/path/index.mf"
|
||||
|
||||
// Exactly what url.Parse renders, with no wrapper of our own.
|
||||
urlParseControlCharErr = `parse "http://example.com/\x7f": ` +
|
||||
`net/url: invalid control character in URL`
|
||||
)
|
||||
|
||||
func TestEncodeFilePath(t *testing.T) {
|
||||
@@ -137,6 +141,16 @@ func TestResolveManifestURL(t *testing.T) {
|
||||
assert.Equal(t, tt.expected, result)
|
||||
})
|
||||
}
|
||||
|
||||
// The sole caller wraps this error as "invalid URL: %w", so
|
||||
// resolveManifestURL must return url.Parse's error unadorned.
|
||||
t.Run("invalid:control character", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
_, err := resolveManifestURL("http://example.com/\x7f")
|
||||
require.ErrorContains(t, err, urlParseControlCharErr)
|
||||
assert.NotContains(t, err.Error(), "failed to parse URL")
|
||||
})
|
||||
}
|
||||
|
||||
// scanToManifest scans sourceFs and returns the serialized manifest bytes.
|
||||
|
||||
Reference in New Issue
Block a user