@@ -70,34 +70,35 @@ export function getDownloadUrl(id, lastUpdated) {
7070}
7171
7272export function getParentFolderUrl ( file ) {
73- if ( file && file . id ) {
74- let folderPath = window . location . pathname ;
75- const pathParts = file . path . split ( '/' ) ;
76- const spaceIndex = pathParts . indexOf ( 'spaces' ) ;
77- if ( spaceIndex !== - 1 ) {
78- if ( pathParts [ spaceIndex + 2 ] === 'Documents' ) {
79- pathParts [ spaceIndex + 2 ] = 'documents' ;
80- }
81- folderPath = pathParts . slice ( spaceIndex + 1 , pathParts . length - 1 ) . join ( '/' ) ;
82- folderPath = `${ eXo . env . portal . context } /g/:spaces:${ folderPath } ` ;
83- } else if ( pathParts . indexOf ( 'Users' ) !== - 1 ) {
84- const parentIndex = pathParts . indexOf ( 'Private' ) ;
85- if ( parentIndex !== - 1 ) {
86- folderPath = pathParts . slice ( parentIndex , pathParts . length - 1 ) . join ( '/' ) ;
87- folderPath = `${ window . location . pathname } /${ folderPath } ` ;
88- }
89- }
90- return folderPath ;
73+ if ( file && file . id ) {
74+ let folderPath = window . location . pathname ;
75+ const pathParts = file . path . split ( '/' ) ;
76+ const spaceIndex = pathParts . indexOf ( 'spaces' ) ;
77+ if ( spaceIndex !== - 1 ) {
78+ if ( pathParts [ spaceIndex + 2 ] === 'Documents' ) {
79+ pathParts [ spaceIndex + 2 ] = 'documents' ;
80+ }
81+ folderPath = pathParts . slice ( spaceIndex + 1 , pathParts . length - 1 ) . join ( '/' ) ;
82+ folderPath = `${ eXo . env . portal . context } /g/:spaces:${ folderPath } ` ;
83+ } else if ( pathParts . indexOf ( 'Users' ) !== - 1 ) {
84+ const parentIndex = pathParts . indexOf ( 'Private' ) ;
85+ if ( parentIndex !== - 1 ) {
86+ folderPath = pathParts . slice ( parentIndex , pathParts . length - 1 ) . join ( '/' ) ;
87+ folderPath = `${ eXo . env . portal . context } /drives/${ folderPath } ` ;
88+ }
9189 }
90+ return folderPath ;
91+ }
9292}
9393
9494export function getEditorUrl ( file , mode ) {
95- const fileId = file . sourceID ? file . sourceID : file . id ;
96- let url = `${ eXo . env . portal . context } /${ eXo . env . portal . portalName } /oeditor?docId=${ fileId } &backTo=${ getParentFolderUrl ( file ) } ` ;
97- if ( mode ) {
98- url += `&mode=${ mode } ` ;
99- }
100- return url ;
95+ const fileId = file . sourceID ? file . sourceID : file . id ;
96+ let url = `${ eXo . env . portal . context } /${ eXo . env . portal . portalName } /oeditor?docId=${ fileId } ` ;
97+ if ( mode ) {
98+ url += `&mode=${ mode } ` ;
99+ }
100+ url += `&backTo=${ getParentFolderUrl ( file ) } ` ;
101+ return url ;
101102}
102103
103104export function getViewType ( appId ) {
0 commit comments