NishantTharani/LogSeqToObsidian

Images from URLs causing issues?

Opened this issue · 2 comments

Error is:

INFO:Destination path: C:\Users\goku\Obsidian\wz_r1.md
Old note path: C:\Users\goku\logseq\journals\2022_12_01.md
Old asset path: C:\Users\goku\logseq\journals\https:\website.com\cdn\2022\20221201.jpg
New asset path: C:\Users\goku\Obsidian\journals\attachments\https:\website.com\cdn\2022\20221201.jpg
Traceback (most recent call last):
  File "C:\Users\goku\LogSeqToObsidian\convert_notes.py", line 441, in <module>
    line = update_assets(line, new_to_old_paths[fpath], fpath)
  File "C:\Users\goku\LogSeqToObsidian\convert_notes.py", line 211, in update_assets
    line = re.sub(r"!\[(.*?)]\((.*?)\)", fix_asset_embed, line)
  File "C:\Users\goku\miniconda3\lib\re.py", line 210, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "C:\Users\goku\LogSeqToObsidian\convert_notes.py", line 191, in fix_asset_embed
    shutil.copyfile(old_asset_path, new_asset_path)
  File "C:\Users\goku\miniconda3\lib\shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc:
OSError: [Errno 22] Invalid argument: 'C:\\Users\\goku\\LS\\journals\\https:\\website.com\\cdn\\2022\\20221201.jpg'

Line in journal is:

	- ![](https://website.com/cdn/2022/20221201.jpg)

I nosed through the script and did not see any code nearby that attempts to download these, would you like me to implement that? For now I've just removed the offending URLs from my journal.

Thank you for writing this.

Hi @doublemover , excellent catch! If you feel like writing some code to accomplish this, that would be much appreciated, and I'd be happy to review a PR. Otherwise, I'll leave this issue open until I get around to it :)

hello @doublemover i've fixed this here :) #16