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
126
126
}
127
127
else
128
128
{
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 };
130
133
pathToParse.make_preferred ();
131
134
path = winrt::to_string (pathToParse.c_str ());
132
135
}
@@ -1523,6 +1526,7 @@ try
1523
1526
1524
1527
if (config.fileCache )
1525
1528
{
1529
+
1526
1530
if (config.path .empty ())
1527
1531
{
1528
1532
config.path = winrt::to_string (ApplicationData::Current ().TemporaryFolder ().Path ()) + " \\ RNFetchBlobTmp_" + taskId;
@@ -1533,7 +1537,7 @@ try
1533
1537
}
1534
1538
1535
1539
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 ()) };
1537
1541
StorageFile storageFile{ co_await storageFolder.CreateFileAsync (path.filename ().wstring (), CreationCollisionOption::FailIfExists) };
1538
1542
IRandomAccessStream stream{ co_await storageFile.OpenAsync (FileAccessMode::ReadWrite) };
1539
1543
outputStream = stream.GetOutputStreamAt (0 ) ;
You can’t perform that action at this time.
0 commit comments