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

Copy Path does not reflect the real path of the object in the media folder #5569

Open
Pageboy opened this issue Jul 1, 2021 · 3 comments
Open
Assignees
Labels
area: media-library good first issue type: bug code to address defects in shipped code

Comments

@Pageboy
Copy link

Pageboy commented Jul 1, 2021

In the media box there is a useful Copy Path button. So, if someone adds a PDF to the media library and they want a link to it, then the Copy Path could be a useful thing. However, the issue is that the path copied starts uploads when it should start /uploads. Of course I can get my user to add the / but I wonder why this happening since the backend specifically says:

media_folder: "/uploads"

Steps to reproduce the behavior. For example:

  1. Go to 'Media'
  2. Select any image or file
  3. Click on Copy Path
  4. Use this path in a link
  5. The link is wrong because the path should reflect the path that is specified in the backend

Screenshots

Screenshot 2021-07-01 at 10 21 14

Screenshot 2021-07-01 at 10 21 43

@Pageboy Pageboy added the type: bug code to address defects in shipped code label Jul 1, 2021
@DenysLins
Copy link

I can fix this issue

DenysLins added a commit to DenysLins/netlify-cms that referenced this issue Jul 1, 2021
see the issue for details

fixes issue decaporg#5569
DenysLins added a commit to DenysLins/netlify-cms that referenced this issue Jul 6, 2021
add a condition to verify if the path already starts with /, so we must not add another one

fixes issue decaporg#5569
DenysLins added a commit to DenysLins/netlify-cms that referenced this issue Jul 7, 2021
add a condition to only add a / is the path is not absolute

fixes issue decaporg#5569
DenysLins added a commit to DenysLins/netlify-cms that referenced this issue Jul 8, 2021
pass the media_folder parameter and use it before setting the path

fixes issue decaporg#5569
DenysLins added a commit to DenysLins/netlify-cms that referenced this issue Jul 8, 2021
Now media_folder must starts with / and path must not starts to be updated

fixes issue decaporg#5569
@asset-web
Copy link

Suggestion:

From an end user's perspective if the "Copy path" function used the "public_folder" vs the "media_folder" suffix this could match usage for wanting to link to a PDF or non image media item using the "link" button from the markdown editor.

@BuckyBuck135
Copy link

I kind of have the reverse problem: the path I set for the public_folder is not respected and an additional / is added at the beginning.
public_folder: src/assets/uploads creates an src for the uploaded images equal to /src/assets/uploads/my-image.jpg

If I manually deleted that starting slash with the markdown editor, the image gets fetch as expected at build time (I'm using Astro where images need to be in src to be processes.

if anyone has any idea. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: media-library good first issue type: bug code to address defects in shipped code
Projects
None yet
5 participants