Skip to content

Commit

Permalink
Add content type data to s3 and create test tempalte
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkjin99 committed Feb 28, 2024
1 parent 09de0f3 commit 136eb9e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/obs3dian/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _replace_name_to_url(line: str, image_name: str, s3_url: str):
# Local file link -> S3 url
local_image_link = r"!\[\[" + image_name + r"\]\]"
if local_link := re.search(local_image_link, line): # 이미지 링크가 존재하는지 탐색
s3_link = f"![][{s3_url}]"
s3_link = f"![]({s3_url})"
line = line.replace(local_link.group(), s3_link) # s3 링크로 대체
return line

Expand Down
1 change: 1 addition & 0 deletions src/obs3dian/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def put_image(self, markdown_path: Path, image_path: Path) -> Path:
Bucket=self.bucket_name,
Body=image_path.open("rb"),
Key=f"{markdown_path.stem} / {image_path.name}",
ContentType=f"image/{image_path.suffix}",
) # upload image
return image_path

Expand Down
Empty file added src/test/__init__.py
Empty file.
Empty file added src/test/test_apply.py
Empty file.
Empty file added src/test/test_config.py
Empty file.
9 changes: 9 additions & 0 deletions src/test/test_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest
from obs3dian.main import run


class TestRun:
# test first init run
# test with profile
# test with access key
pass

0 comments on commit 136eb9e

Please sign in to comment.