kanishka-linux / reminiscence

Self-Hosted Bookmark And Archive Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bookmark-file import fails

Finkregh opened this issue · comments

Hi,

i have a 8400 lines bookmark file that i'd like to import. Currently the web gui says everything is ok and the log says:

dg01     | DEBUG:pages.views:<MultiValueDict: {'file-upload': [<InMemoryUploadedFile: pinboard_export (application/octet-stream)>]}>
dg01     | INFO:pages.views:pinboard_export
dg01     | INFO:pages.views:None

or when i rename the file to foo.html:

dg01     | DEBUG:pages.views:yes
dg01     | DEBUG:pages.views:<MultiValueDict: {'file-upload': [<InMemoryUploadedFile: pinboard_export.html (text/html)>]}>
dg01     | INFO:pages.views:pinboard_export.html
dg01     | INFO:pages.views:text/html

Can i enable some verbose debug log to see where the problem ist?

here is a minimal example that also does not work

commented

I've tested this feature only with bookmark file generated by firefox which follows Netscape Bookmark file format. When importing from file, log output also displays urls, so I think most probably it is not able to recognize file format generated by pinboard.

If possible, if you can output few lines of pinboard_export.html, then it may help in debugging,

Otherwise, if you know little bit of python, then you can also fiddle with utils.py file which contains code related to importing bookmarks.

ugh, the demo file has not been attached... sorry...

<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Pinboard Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p><DT><A HREF="https://blog.pragmaticengineer.com/scaling-engineering-teams-via-writing-things-down-rfcs/" ADD_DATE="1538894065" PRIVATE="0" TOREAD="0" TAGS="culture,programming,engineering,plan">Scaling Engineering Teams via Writing Things Down and Sharing – Aka RFCs</A>

<DT><A HREF="http://changelog.complete.org/archives/9938-the-python-unicode-mess" ADD_DATE="1538849339" PRIVATE="0" TOREAD="0" TAGS="python,unicode,utf8">The Python Unicode Mess</A>

<DT><A HREF="https://www.divio.com/blog/documentation/" ADD_DATE="1538737794" PRIVATE="0" TOREAD="0" TAGS="documentation,writing,learning,guidelines,teaching,howto,education">What nobody tells you about documentation - Blog - Divio</A>

<DT><A HREF="https://grahamc.com/blog/nix-and-layered-docker-images" ADD_DATE="1538420240" PRIVATE="0" TOREAD="0" TAGS="docker,nix,build,nixos">Optimising Docker Layers for Better Caching with Nix - Graham Christensen</A>

<DT><A HREF="http://www.circleid.com/posts/20180924_the_root_ksk_rollover_what_does_it_mean_for_me/" ADD_DATE="1537944192" PRIVATE="0" TOREAD="0" TAGS="DNS,ksk">The Root KSK Rollover? What Does It Mean for Me?</A>
</DL></p>
commented

Thanks for the demo file.

When importing bookmarks, the parser looks for <H3> tag - which is used for enclosing folders. So basically, current code will work only if bookmark links are grouped into various directories. I've not handled the case if there are no directories.

I'll look into it and will try to provide some brute-force method, in case of failure like this.

commented

I've added few fixes in devel branch. In case no directory is found, a dummy directory will be attached to the bookmark content and everything will be added to it. The fix is working fine on demo file. Let me know if it works for you.

It worked, thanks!

An error message would have been nice :)