api-manager icon indicating copy to clipboard operation
api-manager copied to clipboard

[Publisher Portal] Uploaded Documents with Identical Filenames Overwrite Each Other

Open DakshithaS opened this issue 8 months ago • 3 comments

Description

When uploading documents to an API in the WSO2 API Publisher Portal, files are saved using their original local filenames. If two different documents are uploaded with the same filename, the second upload silently overwrites the first. This leads to incorrect file contents being associated with earlier documents.

Steps to Reproduce

  1. Create two text files with the same name but different content:
    • test.txt (File A): contains “This is document A”
    • test.txt (File B): contains “This is document B”
  2. In the Publisher Portal:
    • Create a new API.
    • Add a document named "Doc1" and upload File A.
    • Add another document named "Doc2" and upload File B.
  3. Try to view/download "Doc1".

Actual Behavior:

  • "Doc1" shows the contents of File B instead of File A.
  • File A was silently replaced due to filename collision.

Expected Behavior:

  • Each uploaded file should retain its unique content.
  • Documents should be stored using unique identifiers (e.g., UUID or document ID) rather than using the original filename.

Version

4.5.0

Environment Details (with versions)

No response

DakshithaS avatar May 08 '25 03:05 DakshithaS

Hi, I’d like to work on this issue as part of the WSO2 internship contribution program. Could you please assign it to me?

NivethanKunarathnam avatar Oct 05 '25 03:10 NivethanKunarathnam

Hi👋 Just following up to check if I could get this issue assigned. I’ve already reviewed the code related to document upload in APIPublisherRestApiServiceImpl and can start working once approved. Thank you!

NivethanKunarathnam avatar Oct 09 '25 16:10 NivethanKunarathnam

@YasasRangika @chamilaadhi Hi, I’d like to work on this issue as part of the WSO2 internship contribution program. Could you please assign it to me?

NivethanKunarathnam avatar Oct 29 '25 04:10 NivethanKunarathnam