Skip to content

Commit

Permalink
Merge pull request #26 from OscarLuu/fix_s3_upload_thread_type
Browse files Browse the repository at this point in the history
S3UploadThread fix bug with regex search on bytes
  • Loading branch information
jehiah authored Jul 9, 2024
2 parents 8023d9d + 2835233 commit 38571c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
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="wm@bit.ly" },
]
Expand Down

0 comments on commit 38571c3

Please sign in to comment.