Skip to content

Issue: Image metadata is lost when moving image to a different folder #623

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

Closed
polynook opened this issue Aug 20, 2023 · 8 comments
Closed
Labels

Comments

@polynook
Copy link

polynook commented Aug 20, 2023

Describe the bug
When moving an image with metadata from one folder into another, its metadata is lost in mediaDb.json.

mediaDb.json before moving:

{
    ".frontmatter": {
        "assets": { "media": { "image.png": { "caption": "caption", "alt": "alt", "title": "title" } } }
    }
}

mediaDb.json after moving to new folder:

{ 
    ".frontmatter": {
        "assets": { "media": { "new": { "image.png": {} } } }
    } 
}

To Reproduce
Steps to reproduce the behavior:

  1. Upload an image into a media folder.
  2. Add metadata (alt text, caption).
  3. Move the image in VSCode file browser to a different folder.
  4. Open mediaDb.json — new image location is updated in mediaDb.json, but all metadata is lost.

Expected behavior
When moving an image with metadata in VS Code file browser to another folder, image metadata should be retained in mediaDb.json.

@polynook polynook added the bug Something isn't working label Aug 20, 2023
@polynook polynook changed the title Issue: Image metadata is lost when moving to a different folder Issue: Image metadata is lost when moving image to a different folder Aug 20, 2023
@estruyf
Copy link
Owner

estruyf commented Sep 14, 2023

Thanks, @polynook for opening an issue. I need to think about a way to re-map the media files and their metadata.

@estruyf
Copy link
Owner

estruyf commented Sep 14, 2023

There was an issue in the move file listener. This will be fixed in the upcoming beta.

I also added a new unmapped files feature. When editing a file's metadata, a check will be performed against the metadata, which is not linked to any file with the same filename.

In the following recording you can see the updates:

  1. The new unmapped media feature
  2. The update which should happen on moving files (fixed)
Screen.Recording.2023-09-14.at.17.12.09.mov

@polynook
Copy link
Author

Thanks for improvements, @estruyf.

I've been testing them and the unmapped media feature seems to work great, but the metadata is not being moved in my case.

Code_2023-09-15_13-42-59.mp4

After checking the mediaDb.json before and after moving the file, the mediaDb.json remains unchanged — no entry is deleted nor added. I have to use the unmapped media feature for the changes to be reflected in the mediaDb.json.

@estruyf
Copy link
Owner

estruyf commented Sep 15, 2023

Thanks @polynook for testing. It's good to see that at least the remapping works. ☺️

I will have to check if it would have anything to do with VSCode listeners on Windows.

@polynook
Copy link
Author

Just to add a bit more context, I'm running Front Matter inside a Debian 11 dev container in WSL 2. Maybe it'll be helpful.

estruyf added a commit that referenced this issue Sep 15, 2023
@estruyf
Copy link
Owner

estruyf commented Sep 15, 2023

Think I know what can cause it, should be fixed in the next beta.

@estruyf
Copy link
Owner

estruyf commented Sep 15, 2023

Beta has been released.

@polynook
Copy link
Author

Phenomenal work, @estruyf! Works well now. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants