fix upload 500: add missing _file_suffix to serve server; fix iOS file picker accept types
This commit is contained in:
@@ -612,6 +612,14 @@ async def save_athlete(
|
|||||||
_SUPPORTED_SUFFIXES = {".fit", ".gpx", ".tcx", ".fit.gz", ".gpx.gz", ".tcx.gz"}
|
_SUPPORTED_SUFFIXES = {".fit", ".gpx", ".tcx", ".fit.gz", ".gpx.gz", ".tcx.gz"}
|
||||||
|
|
||||||
|
|
||||||
|
def _file_suffix(name: str) -> str:
|
||||||
|
"""Return the effective suffix, including .gz double-extension."""
|
||||||
|
p = Path(name.lower())
|
||||||
|
if p.suffix == ".gz":
|
||||||
|
return p.stem.rsplit(".", 1)[-1].join([".", ".gz"]) if "." in p.stem else ".gz"
|
||||||
|
return p.suffix
|
||||||
|
|
||||||
|
|
||||||
@app.post("/api/upload")
|
@app.post("/api/upload")
|
||||||
async def upload_activity(
|
async def upload_activity(
|
||||||
files: list[UploadFile] = File(...),
|
files: list[UploadFile] = File(...),
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ try {
|
|||||||
class="border-2 border-dashed border-zinc-700 rounded-lg p-8 text-center text-zinc-500 text-sm cursor-pointer hover:border-zinc-500 hover:text-zinc-300 transition-colors"
|
class="border-2 border-dashed border-zinc-700 rounded-lg p-8 text-center text-zinc-500 text-sm cursor-pointer hover:border-zinc-500 hover:text-zinc-300 transition-colors"
|
||||||
>
|
>
|
||||||
<div id="upload-label">Drop FIT, GPX, TCX, or activities.csv<br/>or click to browse</div>
|
<div id="upload-label">Drop FIT, GPX, TCX, or activities.csv<br/>or click to browse</div>
|
||||||
<input id="upload-input" type="file" accept=".fit,.gpx,.tcx,.fit.gz,.gpx.gz,.tcx.gz,.csv" class="hidden" multiple />
|
<input id="upload-input" type="file" accept=".fit,.gpx,.tcx,.fit.gz,.gpx.gz,.tcx.gz,.csv,application/gpx+xml,application/vnd.garmin.tcx+xml,application/octet-stream" class="hidden" multiple />
|
||||||
</div>
|
</div>
|
||||||
<label class="flex items-start gap-2 mt-3 cursor-pointer group">
|
<label class="flex items-start gap-2 mt-3 cursor-pointer group">
|
||||||
<input
|
<input
|
||||||
|
|||||||
Reference in New Issue
Block a user