dubyte / dir2opds

Serve an OPDS based on a directory
GNU General Public License v3.0
63 stars 12 forks source link

dir2opds on Microsoft Windows generates incorrect path (slashes/directory separator) #7

Closed clach04 closed 3 years ago

clach04 commented 4 years ago

When running dir2opds under Microsoft Windows the wrong directory separator is used, \ versus /. Example:

<feed>
<title>Catalog in /cbz</title>
<id>/cbz</id>
<link rel="start" href="/" type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
<updated>2020-05-25T09:20:39-07:00</updated>
<author>
<name/>
</author>
<entry>
<title>Elf Receiver Radio-Craft August 1936.cbz</title>
<id>/cbzElf Receiver Radio-Craft August 1936.cbz</id>
<link rel="http://opds-spec.org/acquisition" href="\cbz\Elf%20Receiver%20Radio-Craft%20August%201936.cbz" type="application/x-cbz" title="Elf Receiver Radio-Craft August 1936.cbz"/>
<published>2020-05-25T09:20:39-07:00</published>
<updated>2020-05-25T09:20:39-07:00</updated>
</entry>
</feed> 

quick hack to address this is in issue #4 via (probably dumb) string search/replace (I don't know Go well enough to know the best way to handle this).

clach04 commented 4 years ago

hack that works for me https://github.com/clach04/dir2opds/commit/2768fd1a75a11519d2a38d989edceef51d70c51c

dubyte commented 4 years ago

Ahh I see, thanks, I will check that.

dubyte commented 4 years ago

I think instead of filepath.join this should be using: https://golang.org/pkg/path/#Join

That should fix the problem in windows and Linux, I will test later.

dubyte commented 4 years ago

Hello, @clach04 I think I fix this in the last release, could you confirm? Thanks