feat(attachments): Optimize file ID extraction and image conversion

This commit is contained in:
cogwheel0
2025-12-10 19:40:38 +05:30
parent 0fc82d36f7
commit da63e3cbff
7 changed files with 266 additions and 308 deletions

View File

@@ -279,7 +279,10 @@ Map<String, dynamic> _parseOpenWebUIMessageToJson(
allFiles.add(fileMap);
final url = entry['url'].toString();
final match = RegExp(r'/api/v1/files/([^/]+)/content').firstMatch(url);
// Handle both URL formats: /api/v1/files/{id} and /api/v1/files/{id}/content
final match = RegExp(
r'/api/v1/files/([^/]+)(?:/content)?$',
).firstMatch(url);
if (match != null) {
attachments.add(match.group(1)!);
}