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

Downloaded files with slash in tag fields (/) gets converted into new folder #1763

Closed
andylundqvist opened this issue Jun 10, 2022 · 13 comments

Comments

@andylundqvist
Copy link

Description

When downloading files from Navidrome 0.47.5 (from an album or playlist), if a tag field contains a "/" character, the download creates a folder at the place of this character in the file name, thus breaking the general, expected file structure.

Example (correct) : A track "Song A" by artist "John" is correctly named "John - Song A.mp3" when downloaded and is placed in the root directory when unzipped.

Example (incorrect): The track "My Track" by artist "Lisa / Michael" when downloaded and unzipped instead gets the filename: "Michael - My track.mp3" inside a folder called "Lisa".

Expected Behaviour

A common solution for such cases is to convert fields with slash ("/") to an underscore ("_") and I believe this would be an easy fix for the problem.

Platform information

  • Navidrome version: 0.47.5
  • Browser and version: Safari 15.5
  • Operating System: macOS 12.4
@github-actions
Copy link

github-actions bot commented Mar 7, 2023

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Navidrome team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions github-actions bot added the stale label Mar 7, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2023
@andylundqvist
Copy link
Author

andylundqvist commented Apr 6, 2023

I was unable to comment before the issue was marked stale and closed but I can confirm that this bug still exists in the current 0.49.3 version. Do I need to create a new issue for this?

@deluan deluan reopened this Apr 6, 2023
@deluan deluan added go Go code good first issue and removed stale labels Apr 6, 2023
@deluan
Copy link
Member

deluan commented Apr 6, 2023

Thanks for the call-out. I reopened the issue.

@subhajit20
Copy link
Contributor

@deluan hey! I would like to fix this issue also, could you help me like in which file I have to replace the slash with the underscore sign?

@deluan
Copy link
Member

deluan commented Apr 8, 2023

This will require a complete dev environment, with make and all. Were you able to install the whole dev environment in your local?

@subhajit20
Copy link
Contributor

subhajit20 commented Apr 8, 2023

This will require a complete dev environment, with make and all. Were you able to install the whole dev environment in your local?

@deluan hey! Yes, I have installed entire environment setup in my local machine.

@subhajit20
Copy link
Contributor

This will require a complete dev environment, with make and all. Were you able to install the whole dev environment in your local?

@deluan Hey thanks for guiding me and it was my first open-source contribution.

@subhajit20
Copy link
Contributor

@deluan and I have made the local setup done can you guide me that which fil do I have to change in this issue ?

@deluan
Copy link
Member

deluan commented Apr 11, 2023

Hey @subhajit20 , sorry for the delay.

For this we will need to create a function to clean-up filenames. There maybe something ready on the internets, but we don't want to add a new Go dependency just for that ;)

Then this function will be used in the two places used to add files to a zip:

return fmt.Sprintf("%s/%s", mf.Album, file)

and

file := fmt.Sprintf("%02d - %s - %s.%s", idx+1, mf.Artist, mf.Title, ext)

Don't forget to write tests. Let me know if you have any other questions.

@subhajit20
Copy link
Contributor

@deluan so I have to just paste these two functions you have mentioned above in two separate files or anything else?

@deluan
Copy link
Member

deluan commented Apr 28, 2023

You will have to create a function like:

func cleanFilename(name string) string

Then you will use this function in the places I mentioned above. No new files, put this new function in the navidrome/core/archiver.go file.

@deluan deluan closed this as completed in 6bee4ed May 16, 2023
@andylundqvist
Copy link
Author

I haven’t had the time to try it yet but thank you!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants