mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
chore: do not fail if S3 bucket does not handle versions
And mention the need of activating versioning in the doc.
This commit is contained in:
parent
249367fd3a
commit
1ac9a06195
2 changed files with 4 additions and 2 deletions
|
@ -58,4 +58,6 @@ STORAGES = {
|
|||
}
|
||||
```
|
||||
|
||||
In order to store old versions of a layer, the versioning should be activated in the bucket.
|
||||
|
||||
See more about the configuration on the [django-storages documentation](https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html).
|
||||
|
|
|
@ -7,7 +7,6 @@ from pathlib import Path
|
|||
from botocore.exceptions import ClientError
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
|
||||
from django.core.files.base import File
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from rcssmin import cssmin
|
||||
from rjsmin import jsmin
|
||||
|
@ -77,7 +76,8 @@ class UmapS3(S3Storage):
|
|||
metadata = self.connection.meta.client.head_object(
|
||||
Bucket=self.bucket_name, Key=instance.geojson.name
|
||||
)
|
||||
return metadata["VersionId"]
|
||||
# Do not fail if bucket does not handle versioning
|
||||
return metadata.get("VersionId", metadata["ETag"])
|
||||
|
||||
def make_filename(self, instance):
|
||||
return f"{str(instance.pk)}.geojson"
|
||||
|
|
Loading…
Reference in a new issue