Fix Asset filename extraction to use original filenames instead of storage paths #158

Open
opened 2025-10-14 22:06:16 +00:00 by tegwick · 0 comments
Owner

Problem

The Asset.filename property currently extracts filenames from content-addressable storage paths (e.g., b3a5b3c5f9e7f9ee8e4cbeb1ad0fad04f936883695c3de60021f69e60470ace8.png) instead of preserving original filenames (e.g., logo.png).

Root Cause

The _extract_filename_from_path() method in markitect/assets/models.py:108 extracts from the path field, which contains the deduplicated storage path rather than the original file path.

Impact

  • Tests expecting original filenames fail
  • Poor user experience - users see hash-based names instead of meaningful filenames
  • Makes asset identification and management confusing

Proposed Solution

  1. Store original_filename field separately in registry
  2. Use existing original_path field more consistently
  3. Modify deduplicator to preserve original filename metadata

Files Affected

  • markitect/assets/models.py - Asset model filename extraction
  • markitect/assets/registry.py - Asset registration storage
  • markitect/assets/deduplicator.py - Storage path handling

Priority

Medium - Affects user experience but doesn't break functionality

## Problem The Asset.filename property currently extracts filenames from content-addressable storage paths (e.g., b3a5b3c5f9e7f9ee8e4cbeb1ad0fad04f936883695c3de60021f69e60470ace8.png) instead of preserving original filenames (e.g., logo.png). ## Root Cause The _extract_filename_from_path() method in markitect/assets/models.py:108 extracts from the path field, which contains the deduplicated storage path rather than the original file path. ## Impact - Tests expecting original filenames fail - Poor user experience - users see hash-based names instead of meaningful filenames - Makes asset identification and management confusing ## Proposed Solution 1. Store original_filename field separately in registry 2. Use existing original_path field more consistently 3. Modify deduplicator to preserve original filename metadata ## Files Affected - markitect/assets/models.py - Asset model filename extraction - markitect/assets/registry.py - Asset registration storage - markitect/assets/deduplicator.py - Storage path handling ## Priority Medium - Affects user experience but doesn't break functionality
tegwick added this to the Images And File Attachments project 2025-10-14 22:21:06 +00:00
Sign in to join this conversation.