@@ -35,23 +35,25 @@ contextMenu = {
3535
3636 options . share . addEventListener ( 'click' , async ( ) => {
3737
38- const activeItemName = contextMenu . activeEl . querySelector ( '.name' ) . textContent
39- . replaceAll ( '\n' , '' ) ;
38+ const itemName = contextMenu . activeEl . querySelector ( '.name' ) . textContent
39+ . replaceAll ( '\n' , '' ) ;
4040
4141 let link ;
4242
43+ let repoObj ;
44+
4345 if ( contextMenu . activeEl . classList . contains ( 'file' ) ) {
4446
4547 link = createLink ( {
4648 dir : treeLoc ,
47- file : { name : activeItemName } ,
49+ file : { name : itemName } ,
4850 openLive : false
4951 } ) ;
5052
5153 } else if ( contextMenu . activeEl . classList . contains ( 'folder' ) ) {
5254
5355 link = createLink ( {
54- dir : [ treeLoc [ 0 ] , treeLoc [ 1 ] , treeLoc [ 2 ] + '/' + activeItemName ]
56+ dir : [ treeLoc [ 0 ] , treeLoc [ 1 ] , treeLoc [ 2 ] + '/' + itemName ]
5557 } ) ;
5658
5759 } else {
@@ -60,9 +62,15 @@ contextMenu = {
6062
6163 if ( ! fullName ) {
6264
63- fullName = getAttr ( contextMenu . activeEl , 'repoObj' ) ;
65+ repoObj = getAttr ( contextMenu . activeEl , 'repoObj' ) ;
66+
67+ repoObj = JSON . parse ( decodeURI ( repoObj ) ) ;
68+
69+ fullName = repoObj . fullName ;
70+
71+ } else {
6472
65- fullName = JSON . parse ( decodeURI ( fullName ) ) . fullName ;
73+ repoObj = modifiedRepos [ fullName ] ;
6674
6775 }
6876
@@ -75,9 +83,13 @@ contextMenu = {
7583 }
7684
7785 copy ( link ) . then ( ( ) => {
78-
79- const [ user , repo ] = treeLoc ;
80- const repoObj = modifiedRepos [ user + '/' + repo . split ( ':' ) [ 0 ] ] ;
86+
87+ if ( ! repoObj ) {
88+
89+ const [ user , repo ] = treeLoc ;
90+ repoObj = modifiedRepos [ user + '/' + repo . split ( ':' ) [ 0 ] ] ;
91+
92+ }
8193
8294 if ( ! repoObj . private ) {
8395
0 commit comments