-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(frontend): 拡張子内にドットが含まれるものを正常にアップロードできるように #13699
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #13699 +/- ##
============================================
- Coverage 41.58% 14.28% -27.30%
============================================
Files 1617 779 -838
Lines 165038 71389 -93649
Branches 4072 1243 -2829
============================================
- Hits 68631 10198 -58433
+ Misses 95931 60768 -35163
+ Partials 476 423 -53 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
対応必要? |
|
filename.xxx.yyy が aaaaaaa.yyy になって困ること少ない気もする |
困る場合は設定をオフにするとか |
例外の拡張子を列挙するのは管理が面倒になるからあまりやりたくないわね |
例えば aaaa.jpg.webp とかは結局webpだから bbbb.webp になっても問題ないし |
(個人的にはそもそもドライブに |
ピリオドでsplitした最初だけ置き換えるのはダメなのかしら |
いまそうなってるはず |
であれば
は起きえない気がした |
@@ -45,7 +71,7 @@ export function uploadFile( | |||
const reader = new FileReader(); | |||
reader.onload = async (): Promise<void> => { | |||
const filename = name ?? file.name ?? 'untitled'; | |||
const extension = filename.split('.').length > 1 ? '.' + filename.split('.').pop() : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
今の実装はこれ
あ、そうじゃなかった |
ただそうなった場合 |
一般的にファイルシステムにおけるファイル名に拡張子を意味する目的以外でピリオドって使われるものなのかしら |
許容されないわけではないのでまずそう |
非常に稀な気がするけどどうなのかしら(特に英語圏) |
ユーザーがどんなファイル名のファイルをアップロードするかはこちらでコントロールできることではないのでユーザーの行動を信用しないほうが良い気はする |
ファイル名に日付が入っているケース(例 |
🤯 |
'lz4', | ||
'sz', | ||
'z', | ||
'zstd', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
二重拡張子になるファイルがありそうなパターンを追加で調査/検討してみました。
いかがでしょうか?
'zstd', | |
'zstd', | |
'zip', | |
'7z', | |
'gpg', | |
'bak', | |
'old', | |
'diff', | |
'patch', |
'zstd', | ||
] as const; | ||
|
||
function getExtension(filename: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.から始まるファイルの場合にすり抜けてしまいそうな気がしてきました
What
ランダム文字列でアップロードする際に、
tar.gz
など、拡張子内にドットが含まれるファイルの拡張子が正常に処理されない問題を修正Why
Fix #13688 (comment)
Additional info (optional)
Checklist