Skip to content

Commit 65745d5

Browse files
authored
Merge branch 'develop' into issue-281
2 parents 3ed91c4 + 5b8513e commit 65745d5

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ All notable changes to this project will be documented in this file.
44

55
**Warning:** Features marked as *alpha* may change or be removed in a future release without notice. Use with caution.
66

7-
## Unreleased
7+
## [0.13.3] - 2026-02-27
8+
9+
### Fixed
10+
11+
- The `ConformsTo` function on manifests (and by extension, publications) mistakenly checked the manifest's `links`, not its `readingOrder`, for mediatypes that determine whether the manifest is conforming to a certain profile. This may have caused mistaken cases of a11y inferrence or Divina/Audiobook/EPUB/PDF profile detection.
12+
13+
## [0.13.2] - 2026-02-26
814

915
### Fixed
1016

1117
- Fixed a typo in the accessibility metadata (`describeMath` should be `describedMath`).
18+
- File fetcher (for exploded local publications) would panic due to runtime cleanup bug
19+
- Fetcher for archives and exploded publications were [not able to retrieve resources at paths containing special characters](https://github.com/readium/cli/issues/94), such as spaces
1220

1321
## [0.13.1] - 2025-12-08
1422

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
}

pkg/fetcher/fetcher_file.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ func (f *FileFetcher) Links(ctx context.Context) (manifest.LinkList, error) {
7979

8080
// Get implements Fetcher
8181
func (f *FileFetcher) Get(ctx context.Context, link manifest.Link) Resource {
82-
linkHref := link.Href.String()
82+
// use decoded path for local file lookup to support files with spaces and special characters
83+
var linkHref string
84+
if hrefURL := link.Href.Resolve(nil, nil); hrefURL != nil {
85+
linkHref = hrefURL.Path()
86+
} else {
87+
linkHref = link.Href.String()
88+
}
8389
for itemHref, itemFile := range f.paths {
8490
if strings.HasPrefix(linkHref, itemHref) {
8591
resourceFile := filepath.Join(itemFile, strings.TrimPrefix(linkHref, itemHref))
@@ -169,7 +175,6 @@ func (r *FileResource) open() (*os.File, *ResourceError) {
169175
r.file = f
170176
runtime.AddCleanup(r, func(f *os.File) {
171177
f.Close()
172-
r.file = nil
173178
}, f)
174179
return f, nil
175180
}

pkg/manifest/manifest.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ func (m Manifest) ConformsTo(profile Profile) bool {
3131

3232
switch profile {
3333
case ProfileAudiobook:
34-
return m.Links.AllAreAudio()
34+
return m.ReadingOrder.AllAreAudio()
3535
case ProfileDivina:
36-
return m.Links.AllAreBitmap()
36+
return m.ReadingOrder.AllAreBitmap()
3737
case ProfileEPUB:
3838
// EPUB needs to be explicitly indicated in `conformsTo`, otherwise it could be a regular Web Publication.
3939
if slices.Contains(m.Metadata.ConformsTo, ProfileEPUB) && m.ReadingOrder.AllAreHTML() {
4040
return true
4141
}
4242
case ProfilePDF:
43-
return m.Links.AllMatchMediaType(&mediatype.PDF)
43+
return m.ReadingOrder.AllMatchMediaType(&mediatype.PDF)
4444
default:
4545
if slices.Contains(m.Metadata.ConformsTo, profile) {
4646
return true

0 commit comments

Comments
 (0)