@@ -35,6 +35,7 @@ import {
3535} from "./util" ;
3636
3737const SAS_SERVER_HOME_DIRECTORY = "SAS_SERVER_HOME_DIRECTORY" ;
38+ const SAS_FILE_SEPARATOR = "~fs~" ;
3839
3940class RestSASServerAdapter implements ContentAdapter {
4041 protected baseUrl : string ;
@@ -93,7 +94,7 @@ class RestSASServerAdapter implements ContentAdapter {
9394 }
9495
9596 public connected ( ) : boolean {
96- return ! ! this . sessionId ;
97+ return true ;
9798 }
9899
99100 public async setup ( ) : Promise < void > {
@@ -271,9 +272,9 @@ class RestSASServerAdapter implements ContentAdapter {
271272 public async getParentOfItem (
272273 item : ContentItem ,
273274 ) : Promise < ContentItem | undefined > {
274- const parentPathPieces = this . trimComputePrefix ( item . uri ) . split ( "~fs~" ) ;
275- parentPathPieces . pop ( ) ;
276- const fileOrDirectoryPath = parentPathPieces . join ( "~fs~" ) ;
275+ const fileOrDirectoryPath = this . getParentPathOfUri (
276+ this . trimComputePrefix ( item . uri ) ,
277+ ) ;
277278 const response = await this . fileSystemApi . getFileorDirectoryProperties ( {
278279 sessionId : this . sessionId ,
279280 fileOrDirectoryPath,
@@ -335,7 +336,7 @@ class RestSASServerAdapter implements ContentAdapter {
335336 ifMatch : etag ,
336337 fileProperties : {
337338 name : item . name ,
338- path : newFilePath . split ( "~fs~" ) . join ( "/" ) ,
339+ path : newFilePath . split ( SAS_FILE_SEPARATOR ) . join ( "/" ) ,
339340 } ,
340341 } ;
341342
@@ -353,7 +354,7 @@ class RestSASServerAdapter implements ContentAdapter {
353354 ) : Promise < ContentItem | undefined > {
354355 const filePath = this . trimComputePrefix ( item . uri ) ;
355356
356- const parsedFilePath = filePath . split ( "~fs~" ) ;
357+ const parsedFilePath = filePath . split ( SAS_FILE_SEPARATOR ) ;
357358 parsedFilePath . pop ( ) ;
358359 const path = parsedFilePath . join ( "/" ) ;
359360
@@ -394,6 +395,12 @@ class RestSASServerAdapter implements ContentAdapter {
394395 this . updateFileMetadata ( filePath , response ) ;
395396 }
396397
398+ private getParentPathOfUri ( uri : string ) {
399+ const uriPieces = uri . split ( SAS_FILE_SEPARATOR ) ;
400+ uriPieces . pop ( ) ;
401+ return uriPieces . join ( SAS_FILE_SEPARATOR ) ;
402+ }
403+
397404 private filePropertiesToContentItem (
398405 fileProperties : FileProperties & { type ?: string } ,
399406 flags ?: ContentItem [ "flags" ] ,
@@ -426,6 +433,7 @@ class RestSASServerAdapter implements ContentAdapter {
426433 } ,
427434 flags,
428435 type : fileProperties . type || "" ,
436+ parentFolderUri : this . getParentPathOfUri ( id ) ,
429437 } ;
430438
431439 const typeName = getTypeName ( item ) ;
0 commit comments