-
Notifications
You must be signed in to change notification settings - Fork 2
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
PB-35 Implemented external asset urls #433
Conversation
3e6146f
to
0074cdf
Compare
For certain use cases we want to specify a url for the asset instead of uploading it to our s3 bucket. Using the existing href parameter to provide for that
9807e90
to
bb4611e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
app/stac_api/migrations/0037_asset_is_external_collectionasset_is_external.py
Outdated
Show resolved
Hide resolved
app/stac_api/migrations/0039_alter_asset_is_external_and_more.py
Outdated
Show resolved
Hide resolved
Looks good. Maybe also merge all the db migration files into a single file? |
bb4611e
to
44d40c8
Compare
Gonna do that, or at least partially. The changes to the models have separate commits, thus I'm gonna keep their migrations separate as well! |
ca6adf7
to
6dda8f1
Compare
be99cd4
to
298b711
Compare
8cc51c5
to
986f98b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of needing to save the admin form to set a file or external asset, would it be possible to allow to set external or upload a file to begin with, and then return an error on save if the collection does not allow it?
I'm not against it per se, but I would like to hear @boecklic's opinion, especially regarding as to how much effort we want to put into the admin or if that won't even be used that much. |
f46ac78
to
2544338
Compare
Also handle * connection errors, for instance when the domain isn't reachable * redirects and other 300 codes are OK too
Change the regex validation of external asset urls to a list of strings. Matching those in the beginning of the URL
The form didn't allow creating assets anymore. The changes for the file field only worked if the asset already existed.
3b934d8
to
1dbca44
Compare
Refactor the validators on the external asset serializer to the validators module for that purpose. Refactored the Django admin for Assets a bit, fixed a bug in the process.
1dbca44
to
bf47982
Compare
Currently it's unlikely that external assets will be created through admin, except for testing purposes maybe. So the most effortless approach seems good to me. |
Test if the URL's scheme is in a disallowed pattern list, foremost to prevent the usage of http. Also rework the validators a bit so they follow the same naming scheme and indicate that they belong together.
c9c4d38
to
ff10708
Compare
Switch to log level "WARN". Also make sure every validation logs its error, including the collection, so we know who the user might be
ff10708
to
6ae0cd8
Compare
I don't know if this is everything that's needed, but nevertheless I think a review would be good.