Skip to content

Commit

Permalink
fix(zipimage): set mimetype to text plain when undetectable
Browse files Browse the repository at this point in the history
Signed-off-by: John Andersen <johnandersen777@protonmail.com>
  • Loading branch information
johnandersen777 committed Dec 3, 2024
1 parent f5e4b09 commit 30ddd53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

GitHub: https://github.com/publicdomainrelay/atprotobin

Paste
Paste file

```bash
curl -X POST -F file=@README.md https://paste.chadig.com
```

Paste from clipboard (linux with xclip)

```bash
curl -X POST -F file=@<(xclip) https://paste.chadig.com
```

Retrive using id from paste reponse JSON (`| jq -r .id`)

```bash
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "atprotobin"
version = "1.1.0"
version = "1.1.1"
description = "ATProto based pastebin"
readme = {file = "README.md", content-type = "text/markdown"}
authors = [
Expand Down
2 changes: 2 additions & 0 deletions src/atprotobin/zip_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def create_zip_of_files(file_contents, file_name: str = None):
mimetype = mimetypes.guess_file_type(file_name)
else:
mimetype, _encoding = mimetypes.guess_type(file_name)
if mimetype is None:
mimetype = "text/plain"
with zipfile.ZipFile(zip_buffer, 'w', zipfile.ZIP_DEFLATED) as zipf:
zipf.writestr(mimetype, file_contents)
zip_buffer.seek(0)
Expand Down

0 comments on commit 30ddd53

Please sign in to comment.