@@ -190,13 +190,15 @@ public async static Task<StorageFileWithPath> DangerousGetFileWithPathFromPathAs
190
190
}
191
191
}
192
192
193
- if ( parentFolder is not null && ! Path . IsPathRooted ( value ) && ! ShellStorageFolder . IsShellPath ( value ) ) // "::{" not a valid root
194
- {
195
- // Relative path
196
- var fullPath = Path . GetFullPath ( Path . Combine ( parentFolder . Path , value ) ) ;
197
- return new StorageFileWithPath ( await BaseStorageFile . GetFileFromPathAsync ( fullPath ) ) ;
198
- }
199
- return new StorageFileWithPath ( await BaseStorageFile . GetFileFromPathAsync ( value ) ) ;
193
+ var fullPath = ( parentFolder is not null && ! Path . IsPathRooted ( value ) && ! ShellStorageFolder . IsShellPath ( value ) ) // "::{" not a valid root
194
+ ? Path . GetFullPath ( Path . Combine ( parentFolder . Path , value ) ) // Relative path
195
+ : value ;
196
+ var item = await BaseStorageFile . GetFileFromPathAsync ( fullPath ) ;
197
+
198
+ if ( parentFolder is not null && parentFolder . Path . IsSubPathOf ( value ) && parentFolder . Item is IPasswordProtectedItem ppis && item is IPasswordProtectedItem ppid )
199
+ ppid . Credentials = ppis . Credentials ;
200
+
201
+ return new StorageFileWithPath ( item ) ;
200
202
}
201
203
public async static Task < IList < StorageFileWithPath > > GetFilesWithPathAsync
202
204
( this StorageFolderWithPath parentFolder , uint maxNumberOfItems = uint . MaxValue )
@@ -242,16 +244,15 @@ public async static Task<StorageFolderWithPath> DangerousGetFolderWithPathFromPa
242
244
}
243
245
}
244
246
245
- if ( parentFolder is not null && ! Path . IsPathRooted ( value ) && ! ShellStorageFolder . IsShellPath ( value ) ) // "::{" not a valid root
246
- {
247
- // Relative path
248
- var fullPath = Path . GetFullPath ( Path . Combine ( parentFolder . Path , value ) ) ;
249
- return new StorageFolderWithPath ( await BaseStorageFolder . GetFolderFromPathAsync ( fullPath ) ) ;
250
- }
251
- else
252
- {
253
- return new StorageFolderWithPath ( await BaseStorageFolder . GetFolderFromPathAsync ( value ) ) ;
254
- }
247
+ var fullPath = ( parentFolder is not null && ! Path . IsPathRooted ( value ) && ! ShellStorageFolder . IsShellPath ( value ) ) // "::{" not a valid root
248
+ ? Path . GetFullPath ( Path . Combine ( parentFolder . Path , value ) ) // Relative path
249
+ : value ;
250
+ var item = await BaseStorageFolder . GetFolderFromPathAsync ( fullPath ) ;
251
+
252
+ if ( parentFolder is not null && parentFolder . Path . IsSubPathOf ( value ) && parentFolder . Item is IPasswordProtectedItem ppis && item is IPasswordProtectedItem ppid )
253
+ ppid . Credentials = ppis . Credentials ;
254
+
255
+ return new StorageFolderWithPath ( item ) ;
255
256
}
256
257
public async static Task < IList < StorageFolderWithPath > > GetFoldersWithPathAsync
257
258
( this StorageFolderWithPath parentFolder , uint maxNumberOfItems = uint . MaxValue )
0 commit comments