Skip to content

Commit b702123

Browse files
author
Rustam Ibragimov
committed
bug fixes
now checks not only an extension, but whether file can be parsed to XML
1 parent 0552827 commit b702123

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

CacheUpdater/Task.cls.xml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2016.1 (Build 656U)" ts="2016-07-25 16:07:12">
2+
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2016.1 (Build 656U)" ts="2016-08-03 15:01:48">
33
<Class name="CacheUpdater.Task">
44
<Super>%SYS.Task.Definition</Super>
5-
<TimeChanged>64121,39819.499352</TimeChanged>
5+
<TimeChanged>64133,53990.540278</TimeChanged>
66
<TimeCreated>63603,52252.541311</TimeCreated>
77

88
<Parameter name="TaskName">
@@ -180,7 +180,7 @@ Download list of files on https://raw.githubusercontent.com/ server.<br>
180180
181181
182182
Set strload = ""
183-
If ..IsUDLFormat(link) {
183+
If ..IsUDLFormat(stream, link) {
184184
Set stload = ..LoadUDLFile(stream, link)
185185
}
186186
Else {
@@ -362,13 +362,26 @@ Get extension of the file by url
362362
<Method name="IsUDLFormat">
363363
<Description><![CDATA[
364364
Checks whether the url contains a file in udl format
365+
<b>contentStream</b> - the stream which contains the source code.<br>
365366
<b>url</b> - the url where the file is located in the web.<br>]]></Description>
366367
<ClassMethod>1</ClassMethod>
367-
<FormalSpec>url:%String</FormalSpec>
368+
<FormalSpec>contentStream:%GlobalCharacterStream,url:%String</FormalSpec>
368369
<ReturnType>%Boolean</ReturnType>
369370
<Implementation><![CDATA[
370371
Set extensions = "cls,mac,int,inc,dfi"
371-
Return $Find(extensions, $Piece(url, ".", *))
372+
If $Find(extensions, $Piece(url, ".", *)) {
373+
Set st = ##class(%XML.TextReader).ParseStream(contentStream)
374+
Do contentStream.Rewind()
375+
If $$$ISERR(st) {
376+
Return $$$YES
377+
}
378+
Else {
379+
Return $$$NO
380+
}
381+
}
382+
Else {
383+
Return $$$NO
384+
}
372385
]]></Implementation>
373386
</Method>
374387

0 commit comments

Comments
 (0)