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

S3UploadThread fix bug with regex search on bytes #26

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions assetman/S3UploadThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import mimetypes
import logging
import boto3
from assetman.tools import make_output_path, make_absolute_static_path, make_relative_static_path, get_static_pattern, get_shard_from_list
from assetman.tools import make_output_path, make_absolute_static_path, make_relative_static_path, get_static_pattern, get_shard_from_list, _unicode

class S3UploadThread(threading.Thread):
"""Thread that knows how to read asset file names from a queue and upload
Expand Down Expand Up @@ -89,7 +89,7 @@ def exists(self, obj):
try:
self.client.head_object(Bucket=obj.bucket_name, Key=obj.key)
except Exception as e:
logging.error('got %s', e)
logging.error('got %s when searching for %s', e, obj.key)
return False
return True

Expand Down Expand Up @@ -137,7 +137,6 @@ def upload_assets_to_s3(manifest, settings, skip_s3_upload=False):
"""Uploads any assets that are in the given manifest and in our compiled
output dir but missing from our static assets bucket to that bucket on S3.
"""

# We will gather a set of (file_name, file_path) tuples to be uploaded
to_upload = set()

Expand Down Expand Up @@ -205,4 +204,4 @@ def replacer(match):
logging.warning('Missing path %s in manifest, using %s', path, match.group(0))
return match.group(0)
pattern = get_static_pattern(static_url_prefix)
return re.sub(pattern, replacer, src)
return re.sub(pattern, replacer, _unicode(src))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "pyassetman"
description = "assetman assetmanager"
version = "0.3.0rc3"
version = "0.3.0rc4"
authors = [
{ name="Will McCutchen", email="[email protected]" },
]
Expand Down
Loading