Renaming a file in Drive with S3 storage overwrites file_url with local path, breaking File preview

Description: When using S3 storage, renaming a file directly inside the Frappe Drive UI corrupts the file_url stored in the underlying core File DocType. It incorrectly overwrites the S3 route with a local disk path.

Steps to Reproduce:

  1. Configure and enable S3 storage in Drive Settings.

  2. Upload a file via Frappe Drive.

  3. Check the core File DocType: the file_url is correctly formatted as /api/method/drive.api.s3.fetch?path=...

  4. Rename the file directly from the Drive UI.

  5. Check the File DocType again.

Expected Behavior: The file_url should maintain its S3 routing structure with the updated file name.

Actual Behavior: The file_url defaults back to a local path (e.g., /private/files/new_file_name.pdf). This causes the native FileDocType preview to break because the system attempts to read from the local disk. Interestingly, the Drive SPA preview continues to work fine despite the broken core record.

Environment:

  • Frappe version: 16.24.3

  • Drive version: 0.3.0

  • Storage Provider: S3-Compatible (Google Cloud Storage)
    Note: Since that repo is archived, I could’t open an issue, so I am writing here.