Skip to content
Merged
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
9 changes: 8 additions & 1 deletion lib/DBSQLClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ interface IDBSQLClient {
close(): void;
}

function prependSlash(str: string): string {
if (str.length > 0 && str.charAt(0) !== '/') {
return `/${str}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose there is no trimming business here? Someone has sanitized the path before?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No trimming. Slash is required in path, so we just add it when missing; if it's already there - we do nothing

}
return str;
}

export default class DBSQLClient implements IDBSQLClient, EventEmitter {
static utils = new HiveUtils(TCLIService_types);

Expand All @@ -37,7 +44,7 @@ export default class DBSQLClient implements IDBSQLClient, EventEmitter {
host: options.host,
port: options.port || 443,
options: {
path: options.path,
path: prependSlash(options.path),
https: true,
},
},
Expand Down