Skip to content

Commit 3e0a843

Browse files
massongitclaude
andcommitted
fix: puremagic v2のAPIに合わせてwhat()をfrom_file()に変更し、ファイル名の二重ドットを修正
- puremagic.what() を puremagic.from_file() に変更(v2 API対応) - puremagic v2 の from_file() はドット付き拡張子(例: '.png')を返すため、 os.path.extsep.join() で結合すると 'amesh..png' になる問題を修正。 "".join() を使うことで正しく 'amesh.png' として結合されるようにした。 - client.upload() の呼び出しを1行に整形(Black対応) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8da753c commit 3e0a843

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

plugins/hato.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,12 @@ def earth_quake(client: BaseClient):
182182
map_img.save(map_file, format="PNG")
183183

184184
filename = ["map"]
185-
ext = puremagic.what(map_file.name)
185+
ext = puremagic.from_file(map_file.name)
186186

187187
if ext:
188188
filename.append(ext)
189189

190-
client.upload(
191-
file=map_file.name, filename=os.path.extsep.join(filename)
192-
)
190+
client.upload(file=map_file.name, filename="".join(filename))
193191

194192

195193
@action("textlint")
@@ -282,14 +280,12 @@ def amesh(client: BaseClient, place: str):
282280
amesh_img.save(weather_map_file, format="PNG")
283281

284282
filename = ["amesh"]
285-
ext = puremagic.what(weather_map_file.name)
283+
ext = puremagic.from_file(weather_map_file.name)
286284

287285
if ext:
288286
filename.append(ext)
289287

290-
client.upload(
291-
file=weather_map_file.name, filename=os.path.extsep.join(filename)
292-
)
288+
client.upload(file=weather_map_file.name, filename="".join(filename))
293289

294290

295291
@action("amedas", with_client=True)

0 commit comments

Comments
 (0)