Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
Decode href percent encoding in OPF and encryption.xml (readium/r2-lc…
Browse files Browse the repository at this point in the history
…p-swift/#57)
  • Loading branch information
mickael-menu committed Oct 28, 2019
1 parent 8c5f55b commit f1471e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion r2-streamer-swift/Parser/EPUB/EPUBEncryptionParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final class EPUBEncryptionParser: Loggable {
// Loop through <EncryptedData> elements..
for encryptedDataElement in document.xpath("./enc:EncryptedData") {
guard let algorithm = encryptedDataElement.firstChild(xpath: "enc:EncryptionMethod")?.attr("Algorithm"),
var resourceURI = encryptedDataElement.firstChild(xpath:"enc:CipherData/enc:CipherReference")?.attr("URI") else
var resourceURI = encryptedDataElement.firstChild(xpath:"enc:CipherData/enc:CipherReference")?.attr("URI")?.removingPercentEncoding else
{
continue
}
Expand Down
2 changes: 1 addition & 1 deletion r2-streamer-swift/Parser/EPUB/OPFParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ final class OPFParser: Loggable {
/// - Parameter item: The XML element, or manifest XML item.
/// - Returns: The `Link` representing the manifest XML item.
private func makeLink(from manifestItem: XMLElement) -> Link? {
guard let href = manifestItem.attr("href") else {
guard let href = manifestItem.attr("href")?.removingPercentEncoding else {
return nil
}

Expand Down

0 comments on commit f1471e4

Please sign in to comment.