From a2061804be50b16dffc64fc32bfeddb367164738 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Fri, 20 Sep 2024 05:32:37 +1000 Subject: [PATCH] Fix issue #2823: Fix regression of extra quotation marks when using ONEDRIVE_SINGLE_DIRECTORY with Docker (#2826) * Fix regression of extra quotation marks when using ONEDRIVE_SINGLE_DIRECTORY with Docker. Original issue #2318 , original fix #2319 --- src/config.d | 4 +++- src/main.d | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config.d b/src/config.d index 0b44fc146..4720409b5 100644 --- a/src/config.d +++ b/src/config.d @@ -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) { diff --git a/src/main.d b/src/main.d index 4a891d4dd..fae130eff 100644 --- a/src/main.d +++ b/src/main.d @@ -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)), "." );