File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -264,10 +264,16 @@ export class ScriptController {
264264 updatetime : new Date ( ) . getTime ( ) ,
265265 checktime : 0 ,
266266 } ;
267- let old = await this . scriptModel . findByUUID ( script . uuid ) ;
268- if ( ! old && uuid == undefined ) {
267+ let old ;
268+ if ( uuid != undefined ) {
269+ old = await this . scriptModel . findByUUID ( uuid ) ;
270+ } else {
269271 old = await this . scriptModel . findByNameAndNamespace ( script . name , script . namespace ) ;
272+ if ( ! old ) {
273+ old = await this . scriptModel . findByUUID ( script . uuid ) ;
274+ }
270275 }
276+
271277 if ( old ) {
272278 copyScript ( script , old ) ;
273279 } else {
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ export function loadScriptByUrl(url: string): Promise<ScriptUrlInfo | undefined>
9696
9797export function copyScript ( script : Script , old : Script ) {
9898 script . id = old . id ;
99+ script . uuid = old . uuid ;
99100 script . createtime = old . createtime ;
100101 script . checktime = old . checktime ;
101102 script . lastruntime = old . lastruntime ;
You can’t perform that action at this time.
0 commit comments