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

Wrong path when trying to view uploaded images #54

Open
petrakoww opened this issue Oct 14, 2022 · 4 comments
Open

Wrong path when trying to view uploaded images #54

petrakoww opened this issue Oct 14, 2022 · 4 comments

Comments

@petrakoww
Copy link

petrakoww commented Oct 14, 2022

I'm uploading images successfully but when I try to view them the src in the img tag is incorrect.

image

image

It should be only http://localhost:8080/static/colors/6349c2a411aac4c21990aa54/registration/123.png
What am I doing wrong and how to fix it?

@petrakoww
Copy link
Author

petrakoww commented Oct 17, 2022

I found that if I edit the document's bucket to ../../../static/colors it works or kinda works.

image

But if I set the provider to local: { bucket: '../../../static/colors' } it says:
Error: directory: "../../../static/colors" does not exists. Create it before running LocalAdapter

Why is /admin/resources/Test or /admin/resources/ (depending if I'm viewing the document or all) being appended to bucket + path

Also i think this issue is similar to mine.
##35

@petrakoww
Copy link
Author

@dziraf Do you have any idea what causes the problem?

@ddresch
Copy link

ddresch commented Feb 24, 2023

The issue is the baseUrl options parameter, which you are not using. I'm running into a similar situation. I try to run my app in a Docker container, which is not working with the standard local provider (see issue #42). Likewise, I'm currently trying to use a custom provider which is using the move method of the fs-extra package (see here #42 (comment)).

So, the only change is the move method, nothing more, all the rest is the same as the default local provider. I define the custom provider like that:

uploadFileFeature({
        provider: new UploadProvider({
          bucket: path.resolve(`./public/files`),
          opts: {
            baseUrl: '/files',
          },
        }),

As I see it, the baseUrl parameter is ignored and the component uses the bucket path, which is an absolute path and useless for the frontend. I would be happy to any feedback on how this baseUrl needs to be used with a custom provider.

@Reigin16
Copy link

Reigin16 commented Apr 26, 2023

@ddresch
Update your custom provider like this from line 8:
image
now define options like local provider

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

No branches or pull requests

3 participants