Skip to content

Commit e575e9b

Browse files
Do not attempt to set a new remote repo if 'remoteRepo' is not actually present in the request
This may occur for example when settingsUIReadOnly is true where 'remoteRepo' is not user editable
1 parent 68815c1 commit e575e9b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

csp/gitprojectsettings.csp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,16 @@ body {
185185
kill buffer
186186
throw err
187187
}
188-
set newRemote = $Get(%request.Data("remoteRepo",1))
189-
// If entry was modified and git repo is initialized, set new remote repo
190-
set dir = ##class(%File).NormalizeDirectory(settings.namespaceTemp)
191-
if (settings.namespaceTemp '= "") && ##class(%File).DirectoryExists(dir_".git") {
192-
if (newRemote '= ##class(SourceControl.Git.Utils).GetRedactedRemote()) {
193-
do ##class(SourceControl.Git.Utils).SetConfiguredRemote(newRemote)
188+
// Do not attempt to set a new remote repo if 'remoteRepo' is not actually present in the request
189+
// This may occur for example when settingsUIReadOnly is true where 'remoteRepo' is not user editable
190+
if ($data(%request.Data("remoteRepo",1)) '= 0) {
191+
set newRemote = $Get(%request.Data("remoteRepo",1))
192+
// If entry was modified and git repo is initialized, set new remote repo
193+
set dir = ##class(%File).NormalizeDirectory(settings.namespaceTemp)
194+
if (settings.namespaceTemp '= "") && ##class(%File).DirectoryExists(dir_".git") {
195+
if (newRemote '= ##class(SourceControl.Git.Utils).GetRedactedRemote()) {
196+
do ##class(SourceControl.Git.Utils).SetConfiguredRemote(newRemote)
197+
}
194198
}
195199
}
196200
set successfullySavedSettings = 1

0 commit comments

Comments
 (0)