Skip to content

Commit

Permalink
Don't require a self link when parsing a RWPM (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu authored Feb 27, 2025
1 parent 00efcc9 commit ce263fa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
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" }
}

0 comments on commit ce263fa

Please sign in to comment.