diff --git a/CHANGELOG.md b/CHANGELOG.md index 40dc0d5e..a7fce0b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Modifications to local repo files are now synced with IRIS (#153) - Menu items names are properly translated from internal name in VSCode, Management Portal (#372) +- Now has proper locking behavior in `##class(SourceControl.Git.WebUIDriver).HandleRequest()`(#385) +- Git operations from the WebUI now don't unlock the session if they aren't read-only ## [2.3.1] - 2024-04-30 diff --git a/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls b/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls index da34b62d..5f3a8b11 100644 --- a/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls +++ b/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls @@ -71,3 +71,4 @@ Method DeleteFile(item As %String) As %Status } } + diff --git a/cls/SourceControl/Git/Settings.cls b/cls/SourceControl/Git/Settings.cls index dc73319f..aa5357ea 100644 --- a/cls/SourceControl/Git/Settings.cls +++ b/cls/SourceControl/Git/Settings.cls @@ -210,3 +210,4 @@ Method OnAfterConfigure() As %Boolean } } + diff --git a/cls/SourceControl/Git/WebUIDriver.cls b/cls/SourceControl/Git/WebUIDriver.cls index e19827d6..80c6ef37 100644 --- a/cls/SourceControl/Git/WebUIDriver.cls +++ b/cls/SourceControl/Git/WebUIDriver.cls @@ -3,7 +3,6 @@ Class SourceControl.Git.WebUIDriver ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Output handled As %Boolean = 0, Output %data As %Stream.Object) { - do %session.Unlock() // Make sure we capture any stray output set buffer = ##class(SourceControl.Git.Util.Buffer).%New() do buffer.BeginCaptureOutput() @@ -13,6 +12,7 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out #dim %request as %CSP.Request set pathStart = $piece(pagePath,"/",2) if pathStart = "api" { + do %session.Unlock() set handled = 1 set %data = ##class(%Stream.FileCharacter).%New() if $extract(pagePath,6,*) = "userinfo" { @@ -42,6 +42,7 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out SimpleHTTPRequestHandler.do_GET(self) */ if (pathStart = "git") { + do %session.Unlock() if $piece(pagePath,"/",3) = "cat-file" { set blob = $piece(pagePath,"/",4) set name = $Piece(pagePath,"/",*) @@ -107,6 +108,10 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out } set readOnlyCommands = $listbuild("branch","tag","log","ls-files","ls-tree","show","status","diff") set baseCommand = $Piece(args(1)," ") + + if $listfind(readOnlyCommands,baseCommand) { + do %session.Unlock() + } set gitArgs($increment(gitArgs)) = "color.ui=true" diff --git a/csp/webuidriver.csp b/csp/webuidriver.csp index 125e5941..2c42a2df 100644 --- a/csp/webuidriver.csp +++ b/csp/webuidriver.csp @@ -19,17 +19,19 @@ } catch e { // ignore; may occur on platform versions without the above properties } - do %session.Unlock() + // Serve static content when appropriate. // index.html if (url = %base) || (url = $Extract(%base,1,*-1)) { + do %session.Unlock() do %request.Set("FILE","/isc/studio/usertemplates/gitsourcecontrol/index.html") set %stream = 1 quit 1 } // other static resources if $Match(url,"^(.*/img/.*|.*\.(js|map|html|css|woff|woff2))$") { + do %session.Unlock() do %request.Set("FILE","/isc/studio/usertemplates/gitsourcecontrol/"_$Piece(url,%base,2,*)) kill %base set %stream = 1