Skip to content

Commit

Permalink
Use unique folders to remove chance of name collisions
Browse files Browse the repository at this point in the history
Summary: Make sure we a unique temporary folder for operations that could be called concurently (which is most of our APIs) to avoid local file path collisions.

Reviewed By: kiminoue7

Differential Revision: D50102331

fbshipit-source-id: 313648cb73ee3b9a0403beb1634e9fa01508916f
  • Loading branch information
Georges Berenger authored and facebook-github-bot committed Oct 10, 2023
1 parent ee9b529 commit 54aa2ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vrs/utils/FilteredFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ int FilteredFileReader::openFile(unique_ptr<FileHandler>& file) const {
string FilteredFileReader::getCopyPath() {
// if uploading, but no temp file path has been provided, automatically generate one
string fileName = getFileName();
return os::getTempFolder() + (fileName.empty() ? "file.tmp" : fileName);
return os::makeUniqueFolder() + (fileName.empty() ? "file.tmp" : fileName);
}

bool FilteredFileReader::afterConstraint(const string& after) {
Expand Down

0 comments on commit 54aa2ea

Please sign in to comment.