stuff
Some checks failed
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Backend CI / test (push) Has been cancelled
Backend CI / build (push) Has been cancelled

This commit is contained in:
Dmitry 2026-01-24 21:12:19 +03:00
parent 30ce68a949
commit 9041a2cf28

View file

@ -132,13 +132,16 @@ class PacksApiV2 {
}
/// Validates if a string is a valid UUID (object ID in MinIO)
/// Supports UUID with optional file extension (e.g., .mp3, .wav)
bool _isValidUuid(String? value) {
if (value == null || value.isEmpty) return false;
final uuidRegex = RegExp(
r'^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$',
final trimmed = value.trim();
// UUID with optional extension: UUID followed by optional .extension
final uuidWithExtensionRegex = RegExp(
r'^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(\.[a-z0-9]+)?$',
caseSensitive: false,
);
return uuidRegex.hasMatch(value.trim());
return uuidWithExtensionRegex.hasMatch(trimmed);
}
/// Generates presigned URL if value is a UUID (object ID), otherwise returns null