Save Pasted images as Pasted-image-DATE with - instead of spaces

Use case or problem

When doing things with the images in a vault it is more difficult because the image names have spaces in them. The main reason for this is that the images are stored with spaces but in the notes you have to use %20 to refer to these spaces.

I tried to make a program to move files around the %20 just makes it more complicated.

Proposed solution

Replace the spaces in the autogenerated name with -.

Current workaround (optional)

Right now I am using regexes like this to deal with spaces and just renaming it myself to -.

import re
image_with_spaces_pattern = re.compile(r'(!\[.+]\([.\\/A-z0-9]+)(%20)([A-z 0-9.%]+\))')

while re.search(image_with_spaces_pattern, text):
    text = re.sub(image_with_spaces_pattern, r'\1-\3', text)

This pattern is for markdown links.

Do you mean embed the image which is an attachment in the vault?

image

I don’t understand what you mean. I am just talking about the name obsidian generates when you paste an image into a note in the vault. They are usually PASTED IMAGE DATE I think it would be better if these names are seperated with - or _ instead of spaces as the spaces are turned into %20 and the _ and - just stay the same.