Skip to content

Commit 3588181

Browse files
committed
Fix unescaping of paths when reading encryption.xml
1 parent 3c6b32e commit 3588181

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/lcp/lcp.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"fmt"
1414
"io"
1515
"io/fs"
16+
"net/url"
1617
"strings"
1718
)
1819

@@ -184,7 +185,11 @@ func listEncryptedFiles(epubRoot fs.FS) ([]FileEntry, error) {
184185
var res []FileEntry
185186

186187
for _, d := range encryption.EncryptedData {
187-
path := d.CipherData.CipherReference.URI
188+
path, err := url.PathUnescape(d.CipherData.CipherReference.URI)
189+
if err != nil {
190+
return nil, fmt.Errorf("error decoding entry path %q: %w", d.CipherData.CipherReference.URI, err)
191+
}
192+
188193
isCompressed := false
189194
var encryptionAlgorithm EncryptionAlgorithm
190195

0 commit comments

Comments
 (0)