diff --git a/plugins/opds.koplugin/opdsbrowser.lua b/plugins/opds.koplugin/opdsbrowser.lua
index 992b82652..01f714377 100644
--- a/plugins/opds.koplugin/opdsbrowser.lua
+++ b/plugins/opds.koplugin/opdsbrowser.lua
@@ -1624,7 +1624,7 @@ function OPDSBrowser:getSyncDownloadList(url_arg)
local acquisitions_empty = false
-- For project gutenberg
while #sub_table[count].acquisitions == 0 do
- if util.stringEndsWith(sub_table[count].url, ".opds") then
+ if sub_table[count].url and util.stringEndsWith(sub_table[count].url, ".opds") then
acquisitions_empty = true
break
end
diff --git a/spec/unit/opds_spec.lua b/spec/unit/opds_spec.lua
index 3387332b4..a3fb36b4c 100644
--- a/spec/unit/opds_spec.lua
+++ b/spec/unit/opds_spec.lua
@@ -290,6 +290,38 @@ local facet_sample = [[
]]
+-- https://archive2.cbeta.org/opds (single-quoted attributes)
+local single_quote_sample = [[
+
+
+https://www.cbeta.org/opds/index.php
+
+
+CBETA ePub OPDS Catalog
+2023-11-13T00:00:00Z
+
+ Entry One
+
+ 2023-11-13T10:03:10Z
+ https://www.cbeta.org/opds/index.php?vol=T
+
+
+ Entry Two
+
+ 2023-11-13T10:03:10Z
+ https://www.cbeta.org/opds/index.php?vol=X
+
+
+]]
+
local pdf_query_sample = [[
@@ -427,6 +459,17 @@ describe("OPDS module", function()
assert.are.same(item_table[2].title, "Recently added")
assert.are.same(item_table[2].url, "https://catalog.feedbooks.com/publicdomain/browse/recent.atom?lang=en")
end)
+ it("should parse single-quoted attributes", function()
+ local catalog = OPDSParser:parse(single_quote_sample)
+ local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "https://www.cbeta.org/opds/index.php")
+
+ assert.truthy(item_table)
+ assert.are.same(2, #item_table)
+ assert.are.same("Entry One", item_table[1].title)
+ assert.are.same("https://www.cbeta.org/opds/index.php?vol=T", item_table[1].url)
+ assert.are.same("Entry Two", item_table[2].title)
+ assert.are.same("https://www.cbeta.org/opds/index.php?vol=X", item_table[2].url)
+ end)
it("should use the main URL for faceted links as long as faceted links aren't properly supported #internet", function()
local catalog = OPDSParser:parse(facet_sample)
local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "http://flibusta.is/opds")