Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't require a self link when parsing a RWPM #555

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ All notable changes to this project will be documented in this file. Take a look

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

<!-- ## [Unreleased] -->
## [Unreleased]

### Changed

#### Streamer

* A `self` link is not required anymore when parsing a RWPM.


## [3.1.0]

Expand Down
13 changes: 11 additions & 2 deletions Sources/Streamer/Parser/Readium/ReadiumWebPubParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ public class ReadiumWebPubParser: PublicationParser, Loggable {

return await resource.readAsRWPM(warnings: warnings)
.flatMap { manifest in
guard let baseURL = manifest.baseURL else {
return .failure(.decoding("No valid self link found in the manifest"))
let baseURL = manifest.baseURL
if baseURL == nil {
warnings?.log(RWPMWarning(message: "No valid self link found in the manifest", severity: .moderate))
}

return .success(CompositeContainer(
Expand Down Expand Up @@ -165,3 +166,11 @@ private extension Streamable {
}
}
}

/// Warning raised when parsing a RWPM.
public struct RWPMWarning: Warning {
public let message: String
public let severity: WarningSeverityLevel

public var tag: String { "rwpm" }
}