File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,10 @@ RNFetchBlobConfig::RNFetchBlobConfig(winrt::Microsoft::ReactNative::JSValueObjec
126126 }
127127 else
128128 {
129- std::filesystem::path pathToParse{ options[" path" ].AsString () };
129+ auto filepath{ options[" path" ].AsString () };
130+ auto fileLength{ filepath.length () };
131+ bool hasTrailingSlash{ filepath[fileLength - 1 ] == ' \\ ' || filepath[fileLength - 1 ] == ' /' };
132+ std::filesystem::path pathToParse{ hasTrailingSlash ? filepath.substr (0 , fileLength - 1 ) : filepath };
130133 pathToParse.make_preferred ();
131134 path = winrt::to_string (pathToParse.c_str ());
132135 }
@@ -1523,6 +1526,7 @@ try
15231526
15241527 if (config.fileCache )
15251528 {
1529+
15261530 if (config.path .empty ())
15271531 {
15281532 config.path = winrt::to_string (ApplicationData::Current ().TemporaryFolder ().Path ()) + " \\ RNFetchBlobTmp_" + taskId;
@@ -1533,7 +1537,7 @@ try
15331537 }
15341538
15351539 std::filesystem::path path{ config.path };
1536- StorageFolder storageFolder{ co_await StorageFolder::GetFolderFromPathAsync (ApplicationData::Current (). TemporaryFolder ().Path ()) };
1540+ StorageFolder storageFolder{ co_await StorageFolder::GetFolderFromPathAsync ( path. parent_path ().wstring ()) };
15371541 StorageFile storageFile{ co_await storageFolder.CreateFileAsync (path.filename ().wstring (), CreationCollisionOption::FailIfExists) };
15381542 IRandomAccessStream stream{ co_await storageFile.OpenAsync (FileAccessMode::ReadWrite) };
15391543 outputStream = stream.GetOutputStreamAt (0 ) ;
You can’t perform that action at this time.
0 commit comments