Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spaces in the path of the source file(or destination) should be escaped #159

Open
naive231 opened this issue Nov 18, 2022 · 12 comments · May be fixed by #211
Open

Spaces in the path of the source file(or destination) should be escaped #159

naive231 opened this issue Nov 18, 2022 · 12 comments · May be fixed by #211

Comments

@naive231
Copy link

It reports failure like this:

Exporting /Users/zhounaihong/Library/Mobile Documents/iCloud~md~obsidian/Documents2nd_brain/note/2022-11-18.md to Word
Pandoc export failed: pandoc: /Users/naive231/Desktop/2022-11-18.docx: openBinaryFile: does not exist (No such file or directory)

I'm pretty sure that pandoc executive is in system path and I can convert the same document if I call pandoc in shell.

After some investigation, I figured out that the error is coming from the space in the path of the source file:

/Users/zhounaihong/Library/Mobile Documents/iCloud~md~obsidian/Documents2nd_brain/note/2022-11-18.md

If the space in Mobile and Docuemnts isn't escaped with \, pandoc in shell will result to the same error reported in obsidian.

Hope this bug can be fixed in next release, thanks in advanced.

@nanotubing
Copy link

I just ran into the same issue. Let me know if I can provide any information to help

@naive231
Copy link
Author

naive231 commented Dec 3, 2022

I just ran into the same issue. Let me know if I can provide any information to help

Yes, you can help to ask the author to fix it, just place the \ in front of his path variable or place additional " surround with his path variable in his source.😀

@kevinpolisano
Copy link

I have the same issue, since they said in Obsidian-Pandoc-Citations:

Note: it's also possible to put --metadata bibliography=/path/to/report.bib (without any quotes) on a new line in the Extra Pandoc arguments setting to save typing.

But without quotes we cannot escape spaces...

@naive231
Copy link
Author

Note: it's also possible to put --metadata bibliography=/path/to/report.bib (without any quotes) on a new line in the Extra Pandoc arguments setting to save typing.

I don't really understand what it means. What the metadata or bibliography options for?
@OliverBalfour I think we just want an option to let us specified my own output path can solve this problem, and I think you don't need to spent too much efforts to dealt with the "space" problem at all. Maybe you should give this a shot.

@ParkerRobb
Copy link

I have the same problem. It appears that spaces cannot be escaped when entered in "Extra Pandoc arguments", meaning no filepaths can have spaces. I tried it on a filepath with no spaces and it works fine.

@derKlinke
Copy link

I am having the same issue. As a temporary workaround, I created a symbolic link to my .bib file in my User folder and pass it to Pandoc. It would be cool though if this will be fixed in the future :)

@naive231
Copy link
Author

naive231 commented Jan 26, 2023 via email

@GittyBruce
Copy link

GittyBruce commented May 2, 2023

On Line 3356 of main.js, replace:
extraParams = extraParams.flatMap((x) => x.split(" ")).filter((x) => x.length);
with
extraParams = extraParams.flatMap((x) => x).filter((x) => x.length);

And it'll work. Not sure why the the extraparameters value was being split at spaces anyways.

@naive231
Copy link
Author

naive231 commented May 21, 2023 via email

@MengjiaHe
Copy link

Same issue with icloud path!

@ParkerRobb
Copy link

ParkerRobb commented Mar 28, 2024

Looks like #136, #113, #86, #77 all reference the same problem. Some of them provide workarounds.

@ParkerRobb
Copy link

ParkerRobb commented Apr 3, 2024

I modified this .js: $vault_dir/plugins/obsidian-pandoc/main.js I don't actually confirm if that is right. And found following codes: // The metadata title is needed for ePub and standalone HTML formats // We use a metadata file to avoid being vulnerable to command injection if (input.metadataFile) args.push('--metadata-file', input.metadataFile); // Extra parameters if (extraParams) { extraParams = extraParams.flatMap(x => x.split(' ')).filter(x => x.length); args.push(...extraParams); } So, I replace this: extraParams = extraParams.flatMap(x => x.split(' ')).filter(x => x.length); with this: extraParams = extraParams.flatMap((x) => x).filter((x) => x.length); And then I restart the Obsidian to make sure everything should be reloaded. But I invoke "Pandoc Plugin: Export an Word Document (.docx)": [image: image.png] It still can't read my .md: [image: image.png] I don't know if anything else I should change?

On Tue, May 2, 2023 at 11:52 AM GittyBruce @.> wrote: On Line 3356, replace: extraParams = extraParams.flatMap((x) => x.split(" ")).filter((x) => x.length); with extraParams = extraParams.flatMap((x) => x).filter((x) => x.length); And it'll work. Not sure why the the extraparameters value was being split at spaces anyways. — Reply to this email directly, view it on GitHub <#159 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6W66KYYNPY3KK55XPNMDXECAIRANCNFSM6AAAAAASED5EBM . You are receiving this because you authored the thread.Message ID: @.>

@naive231 I found that after making the modification suggested by GittyBruce, using the following form for the Extra Pandoc arguments works:

--defaults=/file path/with spaces/defaults.yaml

Note that there are no quote marks and the spaces are not escaped with \.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants