Skip to content

Commit 59aff2d

Browse files
authored
Merge pull request #388 from intersystems/move-session-unlock
Non read-only webUI git operations lock session
2 parents a35b54c + ee68eb3 commit 59aff2d

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
### Fixed
2525
- Modifications to local repo files are now synced with IRIS (#153)
2626
- Menu items names are properly translated from internal name in VSCode, Management Portal (#372)
27+
- Now has proper locking behavior in `##class(SourceControl.Git.WebUIDriver).HandleRequest()`(#385)
28+
- Git operations from the WebUI now don't unlock the session if they aren't read-only
2729

2830
## [2.3.1] - 2024-04-30
2931

cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ Method DeleteFile(item As %String) As %Status
7171
}
7272

7373
}
74+

cls/SourceControl/Git/Settings.cls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,4 @@ Method OnAfterConfigure() As %Boolean
210210
}
211211

212212
}
213+

cls/SourceControl/Git/WebUIDriver.cls

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Class SourceControl.Git.WebUIDriver
33

44
ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Output handled As %Boolean = 0, Output %data As %Stream.Object)
55
{
6-
do %session.Unlock()
76
// Make sure we capture any stray output
87
set buffer = ##class(SourceControl.Git.Util.Buffer).%New()
98
do buffer.BeginCaptureOutput()
@@ -13,6 +12,7 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
1312
#dim %request as %CSP.Request
1413
set pathStart = $piece(pagePath,"/",2)
1514
if pathStart = "api" {
15+
do %session.Unlock()
1616
set handled = 1
1717
set %data = ##class(%Stream.FileCharacter).%New()
1818
if $extract(pagePath,6,*) = "userinfo" {
@@ -42,6 +42,7 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
4242
SimpleHTTPRequestHandler.do_GET(self)
4343
*/
4444
if (pathStart = "git") {
45+
do %session.Unlock()
4546
if $piece(pagePath,"/",3) = "cat-file" {
4647
set blob = $piece(pagePath,"/",4)
4748
set name = $Piece(pagePath,"/",*)
@@ -107,6 +108,10 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
107108
}
108109
set readOnlyCommands = $listbuild("branch","tag","log","ls-files","ls-tree","show","status","diff")
109110
set baseCommand = $Piece(args(1)," ")
111+
112+
if $listfind(readOnlyCommands,baseCommand) {
113+
do %session.Unlock()
114+
}
110115

111116
set gitArgs($increment(gitArgs)) = "color.ui=true"
112117

csp/webuidriver.csp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@
1919
} catch e {
2020
// ignore; may occur on platform versions without the above properties
2121
}
22-
do %session.Unlock()
22+
2323

2424
// Serve static content when appropriate.
2525
// index.html
2626
if (url = %base) || (url = $Extract(%base,1,*-1)) {
27+
do %session.Unlock()
2728
do %request.Set("FILE","/isc/studio/usertemplates/gitsourcecontrol/index.html")
2829
set %stream = 1
2930
quit 1
3031
}
3132
// other static resources
3233
if $Match(url,"^(.*/img/.*|.*\.(js|map|html|css|woff|woff2))$") {
34+
do %session.Unlock()
3335
do %request.Set("FILE","/isc/studio/usertemplates/gitsourcecontrol/"_$Piece(url,%base,2,*))
3436
kill %base
3537
set %stream = 1

0 commit comments

Comments
 (0)