UAIntegration / ebookdroid

Automatically exported from code.google.com/p/ebookdroid
0 stars 0 forks source link

OPDS link html-entity decode problem with & in url #532

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. If an OPDS catalog item's link contains an ampersand (more than one request 
parameter)
i.e.:
<entry>
  <title>Languages</title>
  <updated>2013-07-04T01:44:18+02:00</updated>
  <id>3:calibre:languages</id>
  <content type="text non">Alphabetical index of the 2 languages</content>
  <link href="/calibre/cops/feed.php?page=17&amp;db=3" type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
  <link href="images/language.png?v=0.5.0" type="image/png" rel="http://opds-spec.org/image/thumbnail"/>
 </entry> 

the following request of ebookdroid looks like:

  /calibre/cops/feed.php?page=17&amp;db=3

instead of:

  /calibre/cops/feed.php?page=17&db=3

So the decoding of "&amp;" seem broken.

What is the expected output?
more OPDS items

What do you see instead?
none or wrong items as request-parameters are missing

What version of the product are you using?
v1.6.6

On what operating system?
Android 4.1.1

What device are you using?
Nexus7

Original issue reported on code.google.com by joma.k...@gmail.com on 4 Jul 2013 at 12:10

GoogleCodeExporter commented 9 years ago
1. Such links are incorrect. hrefs should be URLEncoded, not replaced by XML 
entities.

2. We can try to add support for that invalid links but we need an URL of 
server where we can test.

Original comment by Andrei.K...@gmail.com on 4 Jul 2013 at 6:31

GoogleCodeExporter commented 9 years ago
>1. Such links are incorrect. hrefs should be URLEncoded, not replaced by XML 
entities.

URLEndcoding is not the problem here. The link of the OPDS item contains a 
request parameter which is not interpreted by EBD correctly.

Let's asume following link:

/mycatalog/feed.php?page=1&db=3&whatever=abc

this has to be encoded inside a XML attribute as:

/mycatalog/feed.php?page=1&db=3&whatever=abc

i.e.:
<entry>
  <link href="/mycatalog/feed.php?page=1&db=3&whatever=abc" />
</entry>

because there is no 'standalone' ampersand allowed inside of XML. 

The following is _not_ well-formed (see here for example: 
http://stackoverflow.com/questions/6550451/xml-attribute-not-well-formed):

<entry>
  <link href="/mycatalog/feed.php?page=1&db=3&whatever=abc" />
</entry>

So again: the link is not invalid instead it's 100% correct. What's 'invalid' 
is the interpretation of the link attribute by EBD.

>2. We can try to add support for that invalid links but we need an URL of 
server where we can test.

I am using COPS as OPDS server. You can find a demo page here : 
http://cops-demo.slucas.fr/feed.php

Go deep until the link contains at least two request parameters. For example 
Tags -> Fantasy -> ... and check which url EBD requests.

Original comment by joma.k...@gmail.com on 5 Jul 2013 at 11:24

GoogleCodeExporter commented 9 years ago
Fixed. 

Original comment by Alexander.V.Kasatkin@gmail.com on 25 Dec 2013 at 12:48