@@ -261,7 +261,6 @@ ClassMethod DownloadPackageFromGitHub(url As %String) As %String
261
261
Do fs .CopyFromAndSave (ht .HttpResponse .Data )
262
262
263
263
Set outputFolder = $$$FileTempDir
264
- Do ##class (%File ).CreateDirectory (outputFolder )
265
264
Set res = $zf (-100 , " " , " tar" , " -zxvf" , archiveFileName , " -C" , outputFolder )
266
265
267
266
Return outputFolder
@@ -281,16 +280,29 @@ ClassMethod GetModuleMeta(url As %String) As %DynamicObject
281
280
Set ht .Port = port
282
281
}
283
282
Set ht .Location = tComponents (" path" )_" master/module.xml"
284
-
285
283
$$$ThrowOnError(ht .Get ())
286
284
If (ht .HttpResponse .StatusCode '=200 ) {
287
285
$$$ThrowStatus($$$ERROR(5001 ," Unable to download XML " _ht .Location ))
288
286
}
289
- $$$ThrowOnError(##class (%XML.XPATH.Document ).CreateFromStream (ht .HttpResponse .Data , .xpathdoc ))
287
+ Set tmpFolder = $$$FileTempDir
288
+
289
+ Set stream =##class (%Stream.FileCharacter ).%New ()
290
+ Do stream .LinkToFile (tmpFolder _" /module.xml" )
291
+ Set stream .TranslateTable = " UTF8"
292
+ Do stream .CopyFrom (ht .HttpResponse .Data )
293
+ Do stream .%Save ()
294
+
295
+ set binaryStream =##class (%Stream.FileBinary ).%New ()
296
+ do binaryStream .LinkToFile (tmpFolder _" /module.xml" )
297
+
298
+ $$$ThrowOnError(##class (%XML.XPATH.Document ).CreateFromStream (binaryStream , .xpathdoc ))
290
299
$$$ThrowOnError(xpathdoc .EvaluateExpression (" /" ," Export/Document/Module/Version/text()" , .tResults ))
291
300
set jo .version = tResults .GetAt (1 ).ValueGet ()
292
301
$$$ThrowOnError(xpathdoc .EvaluateExpression (" /" ," Export/Document/Module/Name/text()" , .tResults ))
293
302
set jo .name = tResults .GetAt (1 ).ValueGet ()
303
+
304
+ Do ##class (%File ).RemoveDirectoryTree (tmpFolder )
305
+
294
306
return jo
295
307
}
296
308
@@ -333,7 +345,6 @@ ClassMethod UpdatePackage(jo As %DynamicObject) As %Status
333
345
334
346
ClassMethod Publish (url As %String , name As %String ) As %Status
335
347
{
336
-
337
348
Set outputFolder = ..DownloadPackageFromGitHub (url )
338
349
Set packageFolder = ##class (%File ).NormalizeDirectory (name _ " -master" , outputFolder )
339
350
Return ..LoadPackage (packageFolder , url , 1 )
0 commit comments