Skip to content

Commit ab48c46

Browse files
committed
[feat] #15 Add S3 storage strategy - handle storage_filename and small fixes in readme
1 parent e7889aa commit ab48c46

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ settings:
528528
}
529529
```
530530

531-
And fill the `.env` file with the proper AWS credentials:
531+
Next, populate the appropriate `.env` file (e.g., .env, .env.localhost) with the required AWS credentials:
532532

533533
```bash
534534
AWS_ACCESS_KEY_ID=your-access-key-id
@@ -538,7 +538,7 @@ AWS_S3_BUCKET_NAME=your-bucket-name
538538
```
539539

540540
## License
541-
This project is licensed under the GNU General Public License. See the [LICENSE](LICENSE.md) file for details.
541+
This project is licensed under the GNU General Public License. See the [LICENSE](LICENSE) file for details.
542542

543543
**Important note on [marker](https://github.com/VikParuchuri/marker) license***:
544544

app/storage_strategies/aws_s3.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ def _resolve_placeholder(self, value):
2626
return Template(value).substitute(os.environ)
2727

2828
def save(self, file_name, dest_file_name, content):
29+
formatted_file_name = self.format_file_name(file_name, dest_file_name)
30+
2931
try:
3032
self.s3_client.put_object(
3133
Bucket=self.bucket_name,
32-
Key=dest_file_name,
34+
Key=formatted_file_name,
3335
Body=content.encode('utf-8')
3436
)
35-
print(f"File {dest_file_name} saved to S3 bucket {self.bucket_name}.")
37+
print(f"File {formatted_file_name} saved to S3 bucket {self.bucket_name}.")
3638
except NoCredentialsError:
3739
print("AWS credentials are missing or invalid.")
3840
except ClientError as e:

0 commit comments

Comments
 (0)