File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ export default class InvioPlugin extends Plugin {
105
105
106
106
async viewFileDiff ( filePath : string , diffType : TDiffType ) {
107
107
const file = this . app . vault . getAbstractFileByPath ( filePath )
108
+ if ( ! this . app . vault . adapter . exists ( filePath ) ) {
109
+ new Notice ( `The file(${ filePath } ) does not exist locally` )
110
+ return ;
111
+ }
108
112
if ( ! ( file instanceof TFile ) ) {
109
113
new Notice ( 'Not valid file' ) ;
110
114
return ;
@@ -122,8 +126,15 @@ export default class InvioPlugin extends Plugin {
122
126
client ,
123
127
this . app . vault ,
124
128
this . settings . password
125
- ) ;
129
+ ) . catch ( err => {
130
+ log . error ( 'fetch remote file failed: ' , err ) ;
131
+ return null
132
+ } )
126
133
log . info ( 'remote md: ' , remoteMD ) ;
134
+ if ( ! remoteMD ?. data ) {
135
+ new Notice ( `The file(${ filePath } ) does not exist remotely` )
136
+ return ;
137
+ }
127
138
return new Promise ( ( resolve , reject ) => {
128
139
openDiffModal ( this . app , this , file , {
129
140
data : remoteMD . data ,
You can’t perform that action at this time.
0 commit comments