Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/exec/build/tasks/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path = require("path");
import shell = require("shelljs");
import tasksBase = require("./default");
import trace = require("../../../lib/trace");
import { v1 as uuidv1 } from "uuid";
import uuid = require("uuid");

export interface TaskCreateResult {
taskPath: string;
Expand Down Expand Up @@ -81,7 +81,7 @@ export class TaskCreate extends tasksBase.BuildTaskBase<TaskCreateResult> {

trace.debug("creating definition");
let def: any = {};
def.id = uuidv1();
def.id = uuid.v1();
trace.debug("id: " + def.id);
def.name = taskName;
trace.debug("name: " + def.name);
Expand Down
16 changes: 5 additions & 11 deletions app/lib/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,14 @@ export class TfsConnection {
private collectionUrl: string;

constructor(private serviceUrl: string) {
// Parse URL, but handle failures gracefully to mimic url.parse() behavior
try {
this.parsedUrl = new URL(this.serviceUrl);
} catch (error) {
// Mimic url.parse() behavior for invalid URLs
// url.parse() would return an object with null/empty values instead of throwing
this.parsedUrl = {
protocol: this.serviceUrl && this.serviceUrl.includes('://') ? this.serviceUrl.split('://')[0] + ':' : '',
host: null,
hostname: null,
pathname: this.serviceUrl && !this.serviceUrl.includes('://') ? this.serviceUrl : '',
search: '',
hash: ''
} as any;
if (error.code === "ERR_INVALID_URL") {
throw new Error("Please enter a fully-qualified URL.")
} else {
throw error;
}
}

var splitPath: string[] = this.parsedUrl.pathname.split("/").slice(1);
Expand Down
7 changes: 1 addition & 6 deletions tests/mock-server/utils/RequestParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ export class RequestParser {
const method = req.method || 'GET';
const pathname = parsedUrl.pathname || '';

// Parse query parameters using forEach (guaranteed to be available)
const query: { [key: string]: string } = {};
parsedUrl.searchParams.forEach((value, key) => {
query[key] = value;
});

const query = Object.fromEntries(parsedUrl.searchParams.entries());
const contentType = req.headers['content-type'] || '';

if (method === 'GET' || method === 'DELETE' || method === 'OPTIONS') {
Expand Down
Loading