-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Archive allows the same asset path to be both a directory and a file #1109
Comments
yikes, nice find! Do you know if we already have such in the main deployment of the archive @jwodder ? I guess we are doomed to add a check/error to prevent such cases asap. |
@yarikoptic If there were any of these conflicts in the production archive, I believe it would've caused the backup script to error by now. |
good point. Although backup script is not "on cron" ATM, since we are still polishing the rough angles with the addition of all the zarrs, so conflicts might creep in, although unlikely given that people typically use dandi-cli to upload, so unlikely (albeit possible) to cause such conflicts while having real file system files layout. |
This is because of how S3 stores files (paths only). I'm not sure the best way to deal with this, as it might cause a performance hit if we wanted to try to completely prevent this. Maybe we could roll this into the validation of a dandiset / version? How did you come across this issue? If people are uploading from their file system, this shouldn't occur. |
@AlmightyYakob I came across this while trying to write a unit test for an asset rename method; I was expecting the API to error on renaming an asset path to a folder or a subpath of an asset. |
Ahh okay, that might be more realistic to prevent directly, |
@AlmightyYakob, what would be the approach here--check for the proposed asset name being a prefix of any asset in the system? If there's an efficient DB method for that type of search, then perhaps that fix would be effective without damaging performance too much. |
This check would apply on asset creation or update. I'm not sure exactly what it'd look like, but yes it'd be some kind of check against the path of the proposed asset, and any asset in the specific draft version being uploaded to (so we wouldn't need to check against every asset). |
We'd need to run a once-over to find any existing problems too, right? |
@AlmightyYakob The tests that I mentioned above have started passing; has this issue been resolved? |
Technically yes, since there's now a database constraint that directly prevents this from occuring. However, it's not handled nicely (would return a 500 internal error). I'm going to make a PR soon to handle this correctly. |
🚀 Issue was released in |
When uploading assets to a Dandiset (as well as when changing an asset's
path
), the archive does not prohibit having one asset with pathfoo
and another with pathfoo/bar
, regardless of what order the assets are created in. This is a problem, as it means that "foo
" is both a directory and a file.MVCE for the uploading case:
The text was updated successfully, but these errors were encountered: