azure-pipelines-tasks-webdeployment-common 4.247.0 → 4.252.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -175,26 +175,28 @@ function jsonVariableSubstitution(absolutePath, jsonSubFiles, substituteAllTypes
|
|
|
175
175
|
}
|
|
176
176
|
for (let file of matchFiles) {
|
|
177
177
|
var fileBuffer = fs.readFileSync(file);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
178
|
+
if (fileBuffer.length > 4) {
|
|
179
|
+
var fileEncodeType = fileEncoding.detectFileEncoding(file, fileBuffer);
|
|
180
|
+
var fileContent = fileBuffer.toString(fileEncodeType[0]);
|
|
181
|
+
if (fileEncodeType[1]) {
|
|
182
|
+
fileContent = fileContent.slice(1);
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
fileContent = stripJsonComments(fileContent);
|
|
186
|
+
var jsonObject = JSON.parse(fileContent);
|
|
187
|
+
}
|
|
188
|
+
catch (exception) {
|
|
189
|
+
throw Error(tl.loc('JSONParseError', file, exception));
|
|
190
|
+
}
|
|
191
|
+
console.log(tl.loc('JSONvariableSubstitution', file));
|
|
192
|
+
if (substituteAllTypes) {
|
|
193
|
+
isSubstitutionApplied = substituteJsonVariableV2(jsonObject, envVarObject) || isSubstitutionApplied;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
isSubstitutionApplied = substituteJsonVariable(jsonObject, envVarObject) || isSubstitutionApplied;
|
|
197
|
+
}
|
|
198
|
+
tl.writeFile(file, (fileEncodeType[1] ? '\uFEFF' : '') + JSON.stringify(jsonObject, null, 4), fileEncodeType[0]);
|
|
196
199
|
}
|
|
197
|
-
tl.writeFile(file, (fileEncodeType[1] ? '\uFEFF' : '') + JSON.stringify(jsonObject, null, 4), fileEncodeType[0]);
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
202
|
return isSubstitutionApplied;
|