Skip to content
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

#### Shared

* The `Link` property key for archive-based publication assets (e.g. an EPUB/ZIP) is now `https://readium.org/webpub-manifest/properties#archive` instead of `archive`.


## [3.0.0-alpha.1]

Expand Down
5 changes: 1 addition & 4 deletions Sources/Shared/Fetcher/ArchiveFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ public final class ArchiveFetcher: Fetcher, Loggable {
private extension ArchiveEntry {
var linkProperties: [String: Any] {
[
// FIXME: Legacy property, should be removed in 3.0.0
"compressedLength": compressedLength as Any,

"archive": [
"https://readium.org/webpub-manifest/properties#archive": [
"entryLength": compressedLength ?? length,
"isEntryCompressed": compressedLength != nil,
] as [String: Any],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public extension Properties {

/// Provides information about how the resource is stored in the publication archive.
var archive: Archive? {
try? Archive(json: otherProperties["archive"], warnings: self)
try? Archive(json: otherProperties["https://readium.org/webpub-manifest/properties#archive"], warnings: self)
}
}
6 changes: 2 additions & 4 deletions Tests/SharedTests/Fetcher/ArchiveFetcherTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class ArchiveFetcherTests: XCTestCase {
("META-INF/container.xml", "application/xml", 176, true),
].map { href, type, entryLength, isCompressed in
Link(href: href, type: type, properties: .init([
"compressedLength": (isCompressed ? entryLength : nil) as Any, // legacy
"archive": [
"https://readium.org/webpub-manifest/properties#archive": [
"entryLength": entryLength,
"isEntryCompressed": isCompressed,
] as [String: Any],
Expand Down Expand Up @@ -89,11 +88,10 @@ class ArchiveFetcherTests: XCTestCase {
AssertJSONEqual(
resource.link.properties.json,
[
"archive": [
"https://readium.org/webpub-manifest/properties#archive": [
"entryLength": 595,
"isEntryCompressed": true,
] as [String: Any],
"compressedLength": 595,
] as [String: Any]
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PropertiesArchiveTests: XCTestCase {
}

func testArchive() {
let sut = Properties(["archive": [
let sut = Properties(["https://readium.org/webpub-manifest/properties#archive": [
"entryLength": 8273,
"isEntryCompressed": true,
] as [String: Any]])
Expand All @@ -23,19 +23,19 @@ class PropertiesArchiveTests: XCTestCase {
}

func testInvalidArchive() {
let sut = Properties(["archive": [
let sut = Properties(["https://readium.org/webpub-manifest/properties#archive": [
"foo": "bar",
]])
XCTAssertNil(sut.archive)
}

func testIncompleteArchive() {
var sut = Properties(["archive": [
var sut = Properties(["https://readium.org/webpub-manifest/properties#archive": [
"entryLength": 8273,
]])
XCTAssertNil(sut.archive)

sut = Properties(["archive": [
sut = Properties(["https://readium.org/webpub-manifest/properties#archive": [
"isEntryCompressed": true,
]])
XCTAssertNil(sut.archive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ private func makeProperties(layout: EPUBLayout? = nil, archiveEntryLength: UInt6
] as [String: Any]
}
if let archiveEntryLength = archiveEntryLength {
props["archive"] = [
props["https://readium.org/webpub-manifest/properties#archive"] = [
"entryLength": archiveEntryLength as NSNumber,
"isEntryCompressed": true,
]
Expand Down