Fix: Unescaped dataDir path in start.mjs #97
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
Bug Description
In
zotero-cmd.json
, we are required to set thedataDir
of Zotero, like:In Win32 platform, the value will be converted to
"C:\Zotero\Data"
instart.mjs
, which is invalid inprefs.js
and thus will be reverted to Zotero's default value:C:\Users\<USERNAME>\Zotero
.Solutions
To fix or avoid this error, there are two solutions:
dataDir
with 4\
, i.e.,Use regex to convert
dataDir
to the correct form [Recommended]As shown in this PR, just add
.replace(/\\\\?/g, "\\\\")
inzotero-plugin-template/scripts/start.mjs
Line 64 in 0663e5b
It can convert both
\\
or\\\\
to\\
automatically.Thanks!