Skip to content

Commit 5aeba8a

Browse files
tefkahchocolatkey
andauthored
fix: allow Readium CLI to fetch files with spaces in name by resolving url for archivefetcher rather than straight .String()ing it (#286)
Co-authored-by: Henry <chocolatkey@gmail.com>
1 parent a21aeae commit 5aeba8a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/fetcher/fetcher_archive.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ func (f *ArchiveFetcher) Links(ctx context.Context) (manifest.LinkList, error) {
4444

4545
// Get implements Fetcher
4646
func (f *ArchiveFetcher) Get(ctx context.Context, link manifest.Link) Resource {
47-
entry, err := f.archive.Entry(link.Href.String())
47+
// use decoded path for archive entry lookup to support files with spaces and special characters
48+
var entryPath string
49+
if hrefURL := link.Href.Resolve(nil, nil); hrefURL != nil {
50+
entryPath = hrefURL.Path()
51+
} else {
52+
entryPath = link.Href.String()
53+
}
54+
entry, err := f.archive.Entry(entryPath)
4855
if err != nil {
4956
return NewFailureResource(link, NotFound(err))
5057
}

0 commit comments

Comments
 (0)