0
Under review

V3.0.1 beta OPDS Error: At line 6, column 20: not well-formed (invalid token)

Matthew Bourns 1 year ago updated by Arcane Scroll 6 months ago 13

I just tried to use moon Reader on my android to view my book collection via OPDS. After I select my subcategory and I get to the author folders I get an error for invalidated OPDS content. Here is how I have everything organized with library access authorization for the two users

Books -->sci/fantasy->author->book folders for series & loose epub files

          -->mystery ->Author

Login is successful and all sub categories display correctly, just the same error whenever I try to go below the subcategory.

Here is a partial dump from the log from moonreader the log repeats for each author on the first page of the library that it should be displaying. Let me know if there is anything else you need.

Invalidated OPDS content, please contact owner of this OPDS site to verify below error:

At line 6, column 20: not well-formed (invalid token)

<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:pse="http://vaemendis.net/opds-pse/ns" xmlns:opds="http://opds-spec.org/2010/catalog" xml:lang="en" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">   <id>http://5c97d45ac2ab4b96abb759e355834af9-377148-folders</id>
 <title>Fantasy & SciFi</title>
 <updated>2023-10-29T18:15:38-05:00</updated>
 <icon>/collection/theme/common/favicon.ico</icon>
  <author>
    <name>Ubooquity server</name>
    <uri>/collection</uri>
  </author>

<link type="application/atom+xml; profile=opds-catalog; kind=navigation" rel="self" href="/collection/opds/books/377148"/> <link type="application/atom+xml; profile=opds-catalog; kind=navigation" rel="start" href="/collection/opds"/>

<entry>
<title>Aaronovitch, Ben</title>
<id>377149</id>
<updated>2023-10-13T17:47:51-05:00</updated>
<content type="html"/>
<link type="application/atom+xml; profile=opds-catalog; kind=acquisition" rel="subsection" href="/collection/opds/books/377149/?displayFiles=true"/>
</entry>
<entry>
  <title>Abraham, Daniel</title>
  <id>377163</id>
  <updated>2023-10-13T17:47:52-05:00</updated>
  <content type="html"/>
<link type="application/atom+xml; profile=opds-catalog; kind=acquisition" rel="subsection" href="/collection/opds/books/377163/?displayFiles=true"/>
</entry>

ends
</feed>
<!-- Powered by Ubooquity -->

+1
Under review

Thanks for the detailed report, I will investigate !

Fixed

The page title was not properly escaped, so the special character "&" in "Fantasy & SciFi" triggered the error.

This is fixed and will be in the next version.

Thanks for taking care of that.

I tried this again with version 3.0.2 and get the same error still was this included with the duplicate scan fix?

Yes it's supposed to be fixed.

I'll run some additional tests by putting "&" in as many places as possible and see if something breaks.

I did not manage to reproduce the issue on my side.

Is the error log exactly the same as before ?

This line in the logged XML should not be possible after 3.0.1:

 <title>Fantasy & SciFi</title>

Ampersands (and othe special characters) are now escaped in titles.

Would you mind posting the new log ? Perhaps I missed a second issue.

Under review

Sure here is the last log from moonreader where I get the same error:

Invalidated OPDS content, please contact owner of this OPDS site to verify below error:

At line 6, column 20: not well-formed (invalid token)

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/"
      xmlns:pse="http://vaemendis.net/opds-pse/ns" xmlns:opds="http://opds-spec.org/2010/catalog" xml:lang="en"
      xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
    <id>http://5c97d45ac2ab4b96abb759e355834af9-174130-folders</id>
    <title>Fantasy & SciFi</title>
    <updated>2023-12-30T07:28:49-06:00</updated>
    <icon>/collection/theme/common/favicon.ico</icon>
    <author>
        <name>Ubooquity server</name>
        <uri>/collection</uri>
    </author>

    <link type="application/atom+xml; profile=opds-catalog; kind=navigation" rel="self" href="/collection/opds/books/174130"/>
    <link type="application/atom+xml; profile=opds-catalog; kind=navigation" rel="start" href="/collection/opds"/>

    <entry>
        <title>Aaronovitch, Ben</title>
        <id>174131</id>
        <updated>2023-11-28T15:32:40-06:00</updated>
        <content type="html"/>
        <link type="application/atom+xml; profile=opds-catalog; kind=acquisition" rel="subsection"
              href="/collection/opds/books/174131/?displayFiles=true"/>
    </entry>
    <entry>
        <title>Abraham, Daniel</title>
        <id>174145</id>
        <updated>2023-11-28T15:32:41-06:00</updated>
        <content type="html"/>
        <link type="application/atom+xml; profile=opds-catalog; kind=acquisition" rel="subsection"
              href="/collection/opds/books/174145/?displayFiles=true"/>
    </entry>
...
    <entry>
        <title>Ishiguro, Kazuo</title>
        <id>176925</id>
        <updated>2023-11-28T15:35:31-06:00</updated>
        <content type="html">
        <link type="application/atom+xml; profile=opds-catalog; kind=acquisition" rel="subsection" href="/collection/opds/books/176925/?displayFiles=true">
    </content></entry>


<!-- Powered by Ubooquity -->


So I though I would delete and add my OPDS library to moonreader again incase it was caching something as I still saw the line <title>Fantasy & SciFi. However that has opened a new problem authentication fails everytime. I have a special character in my password, so removed that and tried just alphanumeric numeric and no password and they all fail with the 2 android apps I use moonreader & fbreader for OPDS feeds. If i try a browser though the opds url works everytime. I use http not https

I have been unable to find any logs inside of android that I can access for moonreader or fbreader that might show the request they are sending

here is the log with the login failures, debug mode enabled. collection is my reverse proxy

20231230 15:17:42 [Thread-1625] INFO com.ubooquity.a - Internal server started. Listening on port 2202 (library) and 2203 (admin)
20231230 15:17:58 [qtp1140697305-1717] INFO com.ubooquity.d.d - Basic authentication failed. Access Denied. [login:Expattx ][ip:192.168.50.1]
20231230 15:18:09 [qtp1140697305-1719] INFO com.ubooquity.d.d - Basic authentication failed. Access Denied. [login:expattx ][ip:192.168.50.1]
20231230 15:18:24 [qtp1140697305-1701] WARN o.e.j.server.handler.ContextHandler - Unimplemented getRequestCharacterEncoding() - use org.eclipse.jetty.servlet.ServletContextHandler
20231230 15:18:24 [qtp1140697305-1701] INFO com.ubooquity.d.d - Logon attempt with expired timestamp. Access denied. [login:Expattx ][ip:192.168.50.1]
20231230 15:18:24 [qtp1140697305-1701] INFO com.ubooquity.provider.h.b - Using template LOGIN with following parameters:
rootPath: "/collection"
loginScripts: "\n"
hiddenInputs: "
\"d0809793df2c3be1a77a229781cfe1cdb1a2a\"\
\n
\"1703971104432\"\
\n
"
formId: "loginform"
loginFieldName: "login"
passwordFieldId: "passwordfield"
onLoginClick: "submitform();"
I get the same error

I'm missing something there.

Do you think you could send me your database file ? 
This is the ubooquity-6.mv.db file. Just be sure to stop Ubooquity before copying it.

Note that I will be able to see the names of all your files (but not access the files themselves).
If you prefer and are willing to work a bit more, you can create another database (just launch Ubooquity in another folder) and recreate the issue with just a few files/folder before sending me the database.

However that has opened a new problem authentication fails everytime. I
have a special character in my password, so removed that and tried just
alphanumeric numeric and no password and they all fail with the 2
android apps I use moonreader & fbreader for OPDS feeds. If i try a
browser though the opds url works everytime.

I have had the exact same issue in the past with Moon Reader and FBReader. I don't know where it comes from, although I suspect some credential caching issue on client side (since, as you noticed, the browser never has the issue).

UnfortunateIy I don't remember how the problem went away. Since it was in the middle of big changes, I wiped and reconfigured both my Ubooquity instance and the readers a lot of times. 

I setup a new instance because my current db is over 30gb to get it ready to share with you. What I am scanning is just the fantasy & scifi book library which was the root of the problem. It finished and I was able to get moonreader to login and was able to access all the books without any problem. The interface is now a web interface not the previous folder navigation style, but that maybe because the url is simply host:port/collection/opds 

Thank you for looking into it more for me and fixing the issue, it looks like I need to do a complete db rebuild. I appreciate your time, cheers.

I'm glad it worked out in the end, although I would have prefered to understand why. :D

The interface is now a web interface not the previous folder navigation
style, but that maybe because the url is simply
host:port/collection/opds

You mean in Moon Reader ? You don't have something like that ?

Image 805

Image 806

Yeah it's always best if we now why but I've learnt that development doesn't always gives us that and I take the win :) Correct I get the web view not the view you posted above. I just tried FBReader though and it is displaying as above. There must be something in moonreader which is causing it. I suspect that it must now be loading chrome in the background when you pull up an opds feed. Not an issue with your code though

I'm noticing the same problem in 3.0.2. The spaces around any & in folder names are collapsed and Moonreader returns the same error.  But, it only seems to happen on Moonreader.  I tried it on Librera and it works correctly, so I'm assuming it's a bug in Moonreader.