Uploading photos via Arches Collector and duplicate filename woes

26 views
Skip to first unread message

Angela Labrador

unread,
Jun 4, 2020, 5:03:25 PM6/4/20
to Arches Project
Hi Arches Collector fans,

I've been experiencing the following issue, and wondering if this is expected behavior or a bug:

I have a resource model that basically amounts to a condition assessment report with a file-list node for uploading photos.
  1. I submit a report with a photo from my phone through the collector
  2. Sync the project 
  3. Resulting report is perfect online
  4. I submit a second report with a new photo from my phone through the collector
  5. Sync the project 
  6. Resulting new report is perfect -- BUT the photo in the first report is overwritten by the second report's photo
This seems to be caused by how the collector defaults to naming photos "1.jpg" (rather than using the phone's native filename or uid) -- and so, when the second report is synced to the server, the new photo overwrites the previously uploaded "1.jpg"

Is this expected? Are collector users supposed to manually set a filename? If so, how will they know it's a filename not in use?

It seems as though the process_mobile_data method in datatypes.py would be a convenient place to rename files with a uuid or something? It looks like it's doing some logic to that effect for individual instances (in the case of multiple photos uploaded per report) but not across all existing files.  

As an aside, Arches appears to have the same behavior, but I just haven't encountered the problem because the upload widget doesn't default to "1.jpg" but instead uses the filename provided by the computer, so there's a smaller chance of duplicate names. 

In both cases, this could become quite a problem as it basically allows users to overwrite existing uploaded files without a warning. 

I welcome all ideas and reflections -- especially among those of you dealing with large databases containing lots of uploaded media! (If it matters, this is in an environment where media files are being stored in aws s3 bucket.)

Thanks!

Angela

Angela Labrador

unread,
Jun 12, 2020, 6:22:48 PM6/12/20
to Arches Project
Following up on this thread; Adam Cox and I looked into this further and it appears that this behavior is related to django-storages. There is a setting,  AWS_S3_FILE_OVERWRITE, that defaults to True. (By default files with the same name will overwrite each other. Set this to False to have extra characters appended.). So, adding this to settings_local.py fixed the issue. Anyone using s3 buckets to store uploaded files, will probably want to make sure they have this set to False.

Angela

Cyrus Hiatt

unread,
Jun 13, 2020, 11:50:16 AM6/13/20
to Angela Labrador, Arches Project
That’s very good to know. Thanks Angela and Adam for investigating this issue. 

- Cyrus

-- 
-- To post, send email to arches...@googlegroups.com. To unsubscribe, send email to archesprojec...@googlegroups.com. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archesprojec...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/archesproject/e9ce7add-1598-490d-8274-7339338080d5o%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages