Skip to content

Commit

Permalink
Fix issue #2823: Fix regression of extra quotation marks when using O…
Browse files Browse the repository at this point in the history
…NEDRIVE_SINGLE_DIRECTORY with Docker (#2826)

* Fix regression of extra quotation marks when using ONEDRIVE_SINGLE_DIRECTORY with Docker. Original issue #2318 , original fix #2319
  • Loading branch information
abraunegg authored Sep 19, 2024
1 parent fd3a34e commit a206180
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/config.d
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,9 @@ class ApplicationConfig {
setValueString("skip_dir", configFileSkipDir);
}
} else if (key == "single_directory") {
string configFileSingleDirectory = strip(value, "\"");
// --single-directory Strip quotation marks from path
// This is an issue when using ONEDRIVE_SINGLE_DIRECTORY with Docker
string configFileSingleDirectory = strip(to!string(c.front.dup), "\"");
setValueString("single_directory", configFileSingleDirectory);
} else if (key == "azure_ad_endpoint") {
switch (value) {
Expand Down
6 changes: 5 additions & 1 deletion src/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,12 @@ int main(string[] cliArgs) {

// Are we doing a single directory operation (--single-directory) ?
if (!appConfig.getValueString("single_directory").empty) {
// Ensure that the value stored for appConfig.getValueString("single_directory") does not contain any extra quotation marks
string originalSingleDirectoryValue = appConfig.getValueString("single_directory");
// Strip quotation marks from provided path to ensure no issues within a Docker environment when using passed in values
string updatedSingleDirectoryValue = strip(originalSingleDirectoryValue, "\"");
// Set singleDirectoryPath
singleDirectoryPath = appConfig.getValueString("single_directory");
singleDirectoryPath = updatedSingleDirectoryValue;

// Ensure that this is a normalised relative path to runtimeSyncDirectory
string normalisedRelativePath = replace(buildNormalizedPath(absolutePath(singleDirectoryPath)), buildNormalizedPath(absolutePath(runtimeSyncDirectory)), "." );
Expand Down

0 comments on commit a206180

Please sign in to comment.