cmd: preserve relative paths for files and adapters in CreateHandler

Previously, filepath.Base() was used which stripped directory information
from file paths, causing issues when files with the same name existed in
different subdirectories. The second file would overwrite the first in
the map, losing the reference to one of the files.

This change preserves the full relative path, fixing the issue described
in the TODO comments that were also removed.

Fixes #10333
This commit is contained in:
unbiasedcodex 2025-12-06 04:23:54 -03:00
parent c146a138e3
commit c98848f1f8
1 changed files with 2 additions and 6 deletions

View File

@ -147,10 +147,7 @@ func CreateHandler(cmd *cobra.Command, args []string) error {
return err return err
} }
// TODO: this is incorrect since the file might be in a subdirectory files.Store(f, digest)
// instead this should take the path relative to the model directory
// but the current implementation does not allow this
files.Store(filepath.Base(f), digest)
return nil return nil
}) })
} }
@ -162,8 +159,7 @@ func CreateHandler(cmd *cobra.Command, args []string) error {
return err return err
} }
// TODO: same here adapters.Store(f, digest)
adapters.Store(filepath.Base(f), digest)
return nil return nil
}) })
} }