Skip to content

Commit

Permalink
Fix renaming files with custom model
Browse files Browse the repository at this point in the history
Fixes renaming of files when using a custom model with a primary key name other than 'id'.
  • Loading branch information
esadewater authored Sep 10, 2024
1 parent 3eed807 commit d7e28eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/MediaCollections/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ protected function renameMediaFile(Media $media): void

protected function renameConversionFiles(Media $media): void
{
$mediaWithOldFileName = config('media-library.media_model')::find($media->id);
$mediaWithOldFileName = config('media-library.media_model')::find($media->getKey());
$mediaWithOldFileName->file_name = $mediaWithOldFileName->getOriginal('file_name');

$conversionDirectory = $this->getConversionDirectory($media);
Expand Down

0 comments on commit d7e28eb

Please sign in to comment.