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

encoding image file name #117

Open
lghio opened this issue Jan 20, 2023 · 6 comments · May be fixed by #119
Open

encoding image file name #117

lghio opened this issue Jan 20, 2023 · 6 comments · May be fixed by #119

Comments

@lghio
Copy link

lghio commented Jan 20, 2023

I'm using this pattern to insert the relative link to my images

${imageFileName}

and unfortunately the spaces aren't encoded.

Could you add an option to encode the variables "imageFileName" ?

Thank you for this great extension

@lirantal
Copy link

@lghio there's already logic in the code to handle encoding for spaces. To make that work, you need to enable the config item encodePath and set its value to urlEncodeSpace.

@lghio
Copy link
Author

lghio commented Jan 20, 2023

I understand the settings but it only works on the imagePath, it does not work on the imageName
and I want to use a relative name, so I can't use the imagePath

@lirantal
Copy link

Oh I think you're right, it's encoding applied to the imageFilePath:

if (this.encodePathConfig == "urlEncode") {
imageFilePath = encodeURI(imageFilePath)
} else if (this.encodePathConfig == "urlEncodeSpace") {
imageFilePath = imageFilePath.replace(/ /g, "%20");
}

It looks like it would be a relatively easy fix to add an encoding for the filename specifically. That's what you're asking for, right?

@lghio
Copy link
Author

lghio commented Jan 20, 2023

Yes that's it ;-)
When do you think that could be implemented?

@lirantal
Copy link

I've no idea, I don't have any access to this repo, just a developer using this extension :-)

@lirantal
Copy link

@lghio I submitted a pull request here to suggest the code changes that might fix this issue.

Still, need the maintainer(s) around to review, merge, and publish a new version.

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.

2 participants