aldor007/mort

Fail to get Images from S3

Closed this issue · 3 comments

Hey,

first of all, thank you very much for your work.
Here's my Problem: I've configured a preset bucket like this:

buckets:
    media:
        keys:
          - accessKey: "..."
            aecretAccessKey: "..."
        transform:
            path: "\\/(?P<presetName>[a-z0-9_]+)\\/(?P<parent>.*)"
            checkParent: true
            kind: "presets"
            presets:
                ...
        storages:
            basic:
                kind: "http"
                url: "https://some-server.de/images<item>"

I can successfully access http://localhost:8080/media/test-image.jpg, but http://localhost:8080/media/test/image.jpg is not working.
https://some-server.de/images/test-image.jpg and https://some-server.de/images/test/image.jpg both exist.

When I change the storage-backend to a S3-Bucket, the result is the same.

The log only shows "FileObject decodePreset unknown preset" for the file which cannot be accessed.

I think I tried everything configuration wise. I hope you can help me out here!

Thanks again for your work!

Hi @mkrauser

The issue that I can see is that transform.path is matching http://localhost:8080/media/test/image.jpg that's why there is an error about unknown preset.
You need to change that regexp to something different for example

        transform:
            path: "/transform/(?P<presetName>[a-z0-9_]+)\\/(?P<parent>.*)"
            checkParent: true
            kind: "presets"
            presets:
                ...

Using the above transform.path should allow http://localhost:8080/media/test/image.jpg to work fine. Presets still can be used on path
http://localhost:8080/media/transform/my_preset/test/image.jpg where
my_preset is the name of preset,
test/image.jpg is a path for an image

I hope this will help :)

Thank you very much! It works now. mort almost fits our needs perfectly.
I hope it's ok if I open a PR to improve the docs to explain this a little better.

Hi @mkrauser

Thank you very much! It works now. mort almost fits our needs perfectly.

I'm happy to hear that :)

I hope it's ok if I open a PR to improve the docs to explain this a little better.

Yes, of course. Thank you, very appreciated