1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-22 22:39:36 +02:00

fix: Correct file extension validation for gpx, md, and pdf formats

This commit is contained in:
Sean Morley 2025-03-23 16:40:08 -04:00
parent 7d5750049b
commit b4c5e22662
2 changed files with 4 additions and 4 deletions

View file

@ -14,7 +14,7 @@ def validate_file_extension(value):
import os import os
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
ext = os.path.splitext(value.name)[1] # [0] returns path+filename ext = os.path.splitext(value.name)[1] # [0] returns path+filename
valid_extensions = ['.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.txt', '.png', '.jpg', '.jpeg', '.gif', '.webp', '.mp4', '.mov', '.avi', '.mkv', '.mp3', '.wav', '.flac', '.ogg', '.m4a', '.wma', '.aac', '.opus', '.zip', '.rar', '.7z', '.tar', '.gz', '.bz2', '.xz', '.zst', '.lz4', '.lzma', '.lzo', '.z', '.tar.gz', '.tar.bz2', '.tar.xz', '.tar.zst', '.tar.lz4', '.tar.lzma', '.tar.lzo', '.tar.z', 'gpx', 'md', 'pdf'] valid_extensions = ['.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.txt', '.png', '.jpg', '.jpeg', '.gif', '.webp', '.mp4', '.mov', '.avi', '.mkv', '.mp3', '.wav', '.flac', '.ogg', '.m4a', '.wma', '.aac', '.opus', '.zip', '.rar', '.7z', '.tar', '.gz', '.bz2', '.xz', '.zst', '.lz4', '.lzma', '.lzo', '.z', '.tar.gz', '.tar.bz2', '.tar.xz', '.tar.zst', '.tar.lz4', '.tar.lzma', '.tar.lzo', '.tar.z', '.gpx', '.md', '.pdf']
if not ext.lower() in valid_extensions: if not ext.lower() in valid_extensions:
raise ValidationError('Unsupported file extension.') raise ValidationError('Unsupported file extension.')

View file

@ -74,9 +74,9 @@
'.tar.lzma', '.tar.lzma',
'.tar.lzo', '.tar.lzo',
'.tar.z', '.tar.z',
'gpx', '.gpx',
'md', '.md',
'pdf' '.pdf'
]; ];
export let initialLatLng: { lat: number; lng: number } | null = null; // Used to pass the location from the map selection to the modal export let initialLatLng: { lat: number; lng: number } | null = null; // Used to pass the location from the map selection to the modal