@@ -59,10 +59,12 @@ func validateUrl(_ urlString: String) -> Bool {
59
59
logger? . error ( " \( #function, privacy: . public) - Invalid URL: \( urlString, privacy: . public) " )
60
60
return false
61
61
}
62
- if
63
- ( ptcl != " https: " && ptcl != " http: " )
64
- || ( !path. hasSuffix ( " .css " ) && !path. hasSuffix ( " .js " ) )
65
- {
62
+ if ptcl != " https: " && ptcl != " http: " {
63
+ logger? . error ( " \( #function, privacy: . public) - Invalid URL protocol: \( urlString, privacy: . public) " )
64
+ return false
65
+ }
66
+ if !path. hasSuffix ( " .css " ) && !path. hasSuffix ( " .js " ) {
67
+ logger? . error ( " \( #function, privacy: . public) - Invalid URL suffix: \( urlString, privacy: . public) " )
66
68
return false
67
69
}
68
70
return true
@@ -829,7 +831,7 @@ func checkForRemoteUpdates(_ optionalFilesArray: [[String: Any]] = []) -> [[Stri
829
831
let currentVersion = metadata [ " version " ] ![ 0 ]
830
832
let updateUrl = metadata [ " updateURL " ] ![ 0 ]
831
833
// before fetching remote contents, ensure it points to a file of the same type
832
- if !updateUrl . hasSuffix ( type ) { continue }
834
+ if !validateUrl ( updateUrl ) { continue }
833
835
guard
834
836
let remoteFileContents = getRemoteFileContents ( updateUrl) ,
835
837
let remoteFileContentsParsed = parse ( remoteFileContents) ,
@@ -1812,7 +1814,7 @@ func getFileRemoteUpdate(_ content: String) -> [String: String] {
1812
1814
return [ " error " : " Update failed, couldn't parse remote file contents " ]
1813
1815
}
1814
1816
// check if update is needed
1815
- if version >= remoteVersion {
1817
+ if !isVersionNewer ( version, remoteVersion) {
1816
1818
return [ " info " : " No updates found " ]
1817
1819
}
1818
1820
// at this point it is known an update is available, get new code from downloadURL
0 commit comments