Erroneous "File already present!" error when multiple files exist with same filename in different directories

I have a sentry-fastlane-plugin Github issue open about this, but I figured I’d ask here too in case anyone has a solution.

I’m trying to upload the files and sourcemaps for my React Native app to Sentry using this plugin. I’m getting a “File already present!” error when we try to upload two different files with the same name that are in different directories (src/foo/index.js, src/bar/index.js, etc.). The filename argument I am passing to sentry_upload_file includes the directory (e.g., “/Users/chris/foo/build/backend/index.js”), but that seems to be removed in the call to sentry_upload_file, so that Sentry only sees the index.js part of the filename. Here is what my call to sentry_upload_file looks like:

        sentry_upload_file(
          auth_token: ENV['SENTRY_AUTH_TOKEN'],
          org_slug: ENV['SENTRY_ORG'],
          project_slug: ENV['SENTRY_PROJECT'],
          version: version_number,
          app_identifier: prov_profile_base,
          dist: new_build_num,
          file: file
        )

Here’s an example from our attempt to upload files and sourcemaps for a new build yesterday night where two files called common.js caused the Sentry upload to fail:

[18:11:56]: Uploading /Users/distiller/proj/build/backend/common.js
[18:11:56]: --------------------------------
[18:11:56]: --- Step: sentry_upload_file ---
[18:11:56]: --------------------------------
[18:11:56]: sentry-cli 1.43.0 installed!
[18:11:56]: Starting sentry-cli...
[18:11:56]: A 293a3585c29c8e32049a4fa4cb6e4554489ed374  (192 bytes)
[18:11:56]: Successfully uploaded files to release: com.gingerlabs.proj.production-1.0

Then a bit later…

[18:12:23]: Uploading /Users/distiller/proj/build/common/attachments/common.js
[18:12:23]: --------------------------------
[18:12:23]: --- Step: sentry_upload_file ---
[18:12:23]: --------------------------------
[18:12:23]: sentry-cli 1.43.0 installed!
[18:12:23]: Starting sentry-cli...
[18:12:23]: error: File already present!

Different directories, same filename, kaboom…

Is there an additional argument I can pass to the function so that we can upload multiple files with the same name without an error? Or is there some other workaround for this?

My workaround for this is to upload the main.jsbundle and main.jsbundle.map files instead of the individual build files.