Giter Club home page Giter Club logo

obsidian-custom-attachment-location's Issues

Issue: Custom Attachment Directory Not Created Correctly for Non-Image Attachments (e.g., PDF)

Description

When copying or dragging non-image attachments (such as PDFs), I found that the custom attachment directory is not created correctly, and the attachments are placed in the root directory.

Causes

  • In the drop event: The folder is created using an asynchronous API, but Obsidian's native drop event might execute first, causing the operation to fail.
  • In the paste event: Only the paste of image-type resources is overridden, and there is no specific handling for PDFs. This also encounters the same issue as in point 1.

Possible Solution

For the drop event, a potential solution I thought of is to first prevent the default drop event, wait for the directory to be created and then re-dispatch the native Obsidian drop event.

However, I am not familiar with the Obsidian API and do not know how to re-dispatch the original event. Can someone provide some information or help fix this?

How to keep the original image filename?

I do like this plugin, it provides me with a Typora experience. But it still has some features that make me not adapt to it.

OS: Mac

  • I've set the name of my image file. (I want to keep it)
  • Copy the file from Finder.
  • Paste it in Obsidian with this plugin.
  • If the "pasted image name" has set some value, like ${date}, the image file name would be changed.
  • The paste will fail if the "pasted image name" is empty.

I want to keep the name of the image file as a local file name, or the name from the internet. Is it possible?

Add some options that may be solutions:

  • Auto rename image on/off.
  • Ignore the image file from the same folder(src&dst).
  • After pasting the image, add a select with options of keep the src name or the suggested name.

I know typing ![[, then selecting the image file from the files' list could work, but there are many images in my folder, and I'd like to choose images from Finder.

[Bug] Drag & drop does not use custom attachment name

Hello,

On desktop and mobile (iPad), drag and drop still does not change the image name to custom name (here ${filename}). I've tested with .png, .jpeg and .jpg files.

Wasn't the latest release supposed to solve that issue ?

Thank you !

Environment

Obsidian 1.0.3
Plugin 0.0.9
Windows 11
iPad OS 15.7

${filename} always seems to point to the same file

Currently, I have all of my attached files in "assets".

I would like to have them in "assets/${filename}", but no matter which file I have open and dragging and dropping files into - all of the files go to "assets/Monitor" (Monitor.md was the first note I tried the plugin in).

I tried to restart Obsidian, reinstall the plugin etc.

Disappearing Attachments

I was playing around with the attachment location plugin and now certain attachment images seem to have disappeared. I get a box where the attachment was. Any suggestions?
image

not an issue

So im trying to have a specified folder for all my audio recordings, I thought your plugin would do the job but it doesn't seem like it. I am interested in making my own plugin that does that if it's possible but thought that maybe u can easily implement it to your plugin instead of me making my own one. If u don't wanna make it plz lmk if that is actually doable, i havent made any plugins before and still a beginner in JS

Drag-n-Drop file from explorer doesn't copy file to obsidian vault

plugin settings:
location for new attachments: ./${filename}

plugin version: 0.0.6
obsidian version: 0.13.23

When I drag-n-drop image or other file and folder for this note wasn't created before, plugin just create attachment folder without copying file to this attachment folder.
Can recreate in new vault with legacy editor, but can't understand why sometimes It works and sometimes not. Mostly not is attachment folder wasn't created by plugin before. Can post video if you need.

Fully Control pasted link text (for default size)

When I paste an image, I usually want to resize the image to make it smaller, so I change ![[2022-12-07-1438.jpeg]] to ![[2022-12-07-1438.jpeg|200]]. I'd like to automatically add the |200 upon paste so I don't always need to do it myself, and this could potentially be accomplished by allowing the user to fully customize what text is pasted (could also disable the default embedding of images by removing the preceeding !... I wouldn't do this but perhaps someone would).

Images are pasted in duplicate

Thanks for the great plugin, this is just what I was looking for. However, I'm experiencing a bug where pasting an image pastes two copies: one via the obsidian-custom-attachment-location (in my desired folder), but another link and file in the default Obsidian behavior (the main attachments folder for my entire vault). This behavior remains after disabling all other community plugins and does not occur when images are dragged.

Here is a typical response I see after pasting an image:
image
(the first image is the desired one from obsidian-custom-attachment-location, the second is default Obsidian)

Below are screenshots of my settings for reference.
image
image

it seems there are no detection of the existence of the folder

I write ./${filename}.md/assets in Location box. But when inserting a image to a note, the image file was never created successfully.

I don't think the plugin has the ability to check if a directory exists and generate one if it doesn't. Is it possible to add this feature to the next release?

[Feature Request] Allow saving to hidden folders

Settings:

  • Location for New Attachments: ./assets/${filename}

Behavior:

  • Works as expected, however, the folder structure holding these assets shows up in the Obsidian Navigation pane.

Suggestions:

  • If I change the location to instead point to ./.assets/${filename} the folder structure holding my images now disappears from the Obsidian Navigation pane (desired behavior), however then image links become broken.

Desired Behavior: asset folder does not show up in Obsidian Navigation pane and image links still work as expected.

attachment path add a available ${date} just like qq store attachment by month

Can you add a date variable to the attachment path? I want to create a new folder every month according to the date to store the attachment file of the corresponding month, just like qq stores the received pictures.

In addition, is there any conflict between this plug-in and local images plus? It needs to be combined with this plug-in to automatically download all web images and store them in the corresponding month folder according to the date.

Error While Pasting Text

Current plugin version: 3.0

After pasting normal text, it will automatically be pasted one more time, unless the plugin is disabled.

Contribution maintenance

@RainCat1998 your project is truly amazing. I am a huge fan of it.

But I cannot ignore the fact that your response time is quite big.

Based on your GitHub activity, you have huge gaps in your availability.

Maybe your project will benefit from including additional contributors with write permission?

If you are open to it, please consider my candidacy.

Plugin not supported on mobile

When I try to add this plugin on my Android tablet, I see the below error "This plugin does not support your device". Is it not supported by design?

image

Obsidian Canvas ?

Hello,

Will it be possible to use this with Obsidian Canvas?

Thanks!

iOS Support?

Any possibility for adding iOS support to this plugin?

How to target the vault root folder?

Is there a way to target a specific folder in the root of the vault?
-Vault Root
--Attachments
--Notes
---note.md

Is there a way when I paste an image into note.md it automatically be saved into Attachments/note/ folder?
tnx

automatic renaming of attachment folder on filename change

your plugin is working flawlessly. Thanks a ton for making this, it's really useful.

I imagine this would take a bit of work, but just wanted to suggest that it'd be a great feature if there was a way to keep the attachment folder name synchronized with the note's filename. I often rename notes and it'd be fantastic if there was a way to automatically rename the attachment folder and associated links.

Feature Request: Option to add folder name to the renamed file

If I am saving attachments to a folder called "2022-01-26 Meeting", I would like the ability to rename an attachment to be {folderName}-{filename}.

That way I will recognize the file names even if they get decoupled from the folder, or if I am using an external tool to search by file names.

If you like the feature, I may give it a go in a local branch.

Drag and drop does not use custom attachment name

Hello,

Thanks for this great plugin ! I just noticed that drag and drop still does not work : it does not change the image name to my custom name (${filename}).

Wasn't the latest release supposed to solve that issue ?

Thanks !

Obsidian 0.13.19
Plugin 0.0.6
Windows 10 21H2

Using Pandoc to export failed

Obsidian Pandoc plugin could not find the assets when exporting PDF or docx format file. It tries to find images in the root folder. Is there a way to work around this incompatibility?

[Feature Request] Option to attachment images using Markdown links format with relative path

Hi,
To bulid a more compatible vault, I'm looking for a way to attachment images using Markdown format ![]() with relative path, meanwhile linking notes using Wikilinks format [[ ]].
Sadly, while obsidian supports both these format and provides option to turn off Use [[Wikilinks]], it would affect both images links and note links. I wonder if you could consider to add a option to let us attachment images using only Markdown links format with relative path. If implement this feature, the note file could be more compatible, as the images attached could be correctly read by most markdown editor.
After all, thanks for your amazing plugins!

[bug] Paste doesn't work if configured directory contains "." (dot)

I'm trying to configure the name starting from "." (dot). It's standard for hidden files/directories on Linux.

Steps to reproduce:

  1. Configure as follow
    image
  2. E.g. make screenshot
  3. Try to paste

Expected result:

  • Directory created with file inside
  • image pasted into note

Actual result:

  • nothing happens

Attachment folder setting is not updated after renaming note

  1. Consider note OldName.md without any attachments
  2. Rename it to NewName.md
  3. Attach Attachment.pdf to renamed note

Actual result: Attachment.pdf is added to the folder corresponding to OldName.md

Expected result: Attachment.pdf is added to the folder corresponding to NewName.md

Assets saved in wrong folder

Hi, I really like the idea of having attachments ordered in folders that match notes name.
I tried this plugin without success.

v 0.0.7
Setting:
Location for new attachments: assets/${filename}
Automatic rename [...]: Checked

Problem:
The first attachment is not saved into the requested folder.

Reproducable behaviour:

  • copy first attachment into note
  • => folder assets/${filename} gets created, but attachment is saved in obsidian workspace root
  • copy another attachment into note
  • => attachment is copied into assets/${filename} as it should be

... if it is of any importance: I am using Obsidian on Win10, Workspace is located on mapped NAS

[feature request] Can we support ${prompt} when paste screenshoot

it's a great extensition that could define the ${file} and ${date} with the image location & filename.
sometimes I want to make the filename more meaningful and the VsCode extension "Markdown Image" just support ${prompt}: Makes it possible to enter a custom name through an input prompt when pasting the image.

[Feature Request] The directory structure of the image is the same as the directory structure of the notes

if we have notes as tree:

  • inbox
    • first.md
    • second.md
  • journal
    • first.md
    • second.md

if set images root path in /assets, hope to have same directory structure

  • assets
    • inbox
      • first
        • image-20220318xxx.png
        • image-20220318yyy.png
      • second
        • image-20220318xxx.png
        • image-20220318yyy.png
    • journal
      • first
        • image-20220318xxx.png
        • image-20220318yyy.png
      • second
        • image-20220318xxx.png
        • image-20220318yyy.png

now, if we set 'Location for New Attachments' = 'assets/${filename}', only have filename as directory

so, if implement this feature, we can have all image in one root directory and easy to find all images of one note according path

thank you for this amazing plugin.

File names with name "++ " and other text raises error

Having a ++ But - Obsidian does not like ++ in a title causes error. It is the leading ++ that causes the problem.

I use + Title and ++ Title to make those files float to top of the list in a sorted view.

The console log of Obsidian shows

SyntaxError: Invalid regular expression: /^./_resources/++ Bug - Obsidian does not like ++ in title$/: Nothing to repeat (at plugin:obsidian-custom-attachment-location:4558:12)
    at new RegExp (<anonymous>)
    at CustomAttachmentLocationPlugin.interpolateToDigitRegex (plugin:obsidian-custom-attachment-location:4558:12)
    at CustomAttachmentLocationPlugin.getEarliestAttachmentFolder (plugin:obsidian-custom-attachment-location:4584:30)
    at CustomAttachmentLocationPlugin.getAttachmentFolderPath (plugin:obsidian-custom-attachment-location:4600:23)
    at CustomAttachmentLocationPlugin.handleFileOpen (plugin:obsidian-custom-attachment-location:4697:29)
    at eval (plugin:obsidian-custom-attachment-location:4492:41)
    at e.tryTrigger (app.js:1:723190)
    at e.trigger (app.js:1:723123)
    at t.trigger (app.js:1:2283688)
    at t.activeLeafEvents (app.js:1:2269215)
    at l (app.js:1:522936)
    at c (app.js:1:523052)

Mobile support

This plugin feels unusable for someone who switches between mobile and desktop since the plugin won't work on mobile

The problem of custom folder

Hi! Thanks for your plugin. Some remarks:

  1. The plugin resets the custom folder to "assets". If I try to change the folder to something like "Images/${filename}" it will anyway reset and save to "assets".
  2. Is there any way to use the top-level folders? For example "../Images/${filename}"?

Obsidian 0.13.19.

Hidden folder

Hi there,

I was trying to use a hidden folder ./.screens/${filename} as the Location for New Attachments but it does not work when I paste some images. All the other settings are still the default one.

The folder and subfolder are correctly created but the file (PNG picture in this case) never appear in the folder nor in the note.

Let me know if you need more info.

Toggle image renaming [feature request]

I would like to have an option to toggle image renaming on / off. Currently I'm renaming files and giving images descriptive names, so I'd like to be able to disable this plugin from force renaming my images. I like the attachment location option with {filename} variable, really handy, but renaming images is unnecessary for me. Is there a way to disable it and if not, please make this a feature.

Custom duplicate number delimiter

Currently, the duplicate number delimiter is whitespace. Can I set the delimiter to be hyphen?

So when I paste three images, they will be named image, image-1, image-2, instead of image, image 1, image 2.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.