From 2835233193fced4bc1ca21146d58e2ccb1536a40 Mon Sep 17 00:00:00 2001 From: oscar Date: Tue, 9 Jul 2024 11:16:25 -0700 Subject: [PATCH] S3UploadThread fix bug with regex search on bytes --- assetman/S3UploadThread.py | 7 +++---- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/assetman/S3UploadThread.py b/assetman/S3UploadThread.py index af378a4..f7bc98d 100755 --- a/assetman/S3UploadThread.py +++ b/assetman/S3UploadThread.py @@ -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 @@ -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 @@ -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() @@ -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)) diff --git a/pyproject.toml b/pyproject.toml index dcbb5ab..beebecc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" }, ]