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

How to rename remove space? #111

Open
roytoh opened this issue Apr 1, 2024 · 5 comments
Open

How to rename remove space? #111

roytoh opened this issue Apr 1, 2024 · 5 comments

Comments

@roytoh
Copy link

roytoh commented Apr 1, 2024

I tested ${originalname.replace(/\s/g, '')}

But still can't remove space from original file name

@roytoh
Copy link
Author

roytoh commented Apr 1, 2024

main.zip

I manage to edit the script to directly replace that ${originalname} to include a requirement to remove spaces.

Sorry for this method because i'm not IT background, I only knew html and sql, currently learning js

The file attached is main.js in the plugin file.

@wavetg
Copy link

wavetg commented Apr 6, 2024

When there are spaces in the filename, the attachment is named in url encode, and I would like to be able to display the spaces properly

@roytoh
Copy link
Author

roytoh commented Apr 7, 2024

When there are spaces in the filename, the attachment is named in url encode, and I would like to be able to display the spaces properly

Url not possible to have spaces if not mistaken. I'm self learn coder so theory i might not good. But as i saw website or url don't have spaces. So i think not possible to display space in url encode.

Do i get your question correct?

@wavetg
Copy link

wavetg commented Apr 7, 2024

When there are spaces in the filename, the attachment is named in url encode, and I would like to be able to display the spaces properly

Url not possible to have spaces if not mistaken. I'm self learn coder so theory i might not good. But as i saw website or url don't have spaces. So i think not possible to display space in url encode.

Do i get your question correct?

What I mean is that when inserting an image in an obisidian file, this plugin will automatically name it for me, and I want to use the current md filename as the name of the attachment, at this point, if there are spaces in the md filename, then there will be spaces in the name of the attachment in the form of url encode.
For example, when the file name is Java scripts, when I use the filename variable as the name of the attachment, then the name of the attachment will be modified as Java%20scripts

@trganda
Copy link
Owner

trganda commented Apr 9, 2024

I tested ${originalname.replace(/\s/g, '')}

But still can't remove space from original file name

There was no real expression language support in this plugin, it's just a replacement. So you can't use replace() in ${}, if you want to remove the space of your attach file, this plugin may not helping your.

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

No branches or pull requests

3 participants