Skip to content

Commit 45a2176

Browse files
committed
fix some notes after review
1 parent 6753e19 commit 45a2176

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

packages/cubejs-backend-shared/src/http-utils.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export async function streamWithProgress(
6666
type DownloadAndExtractFile = {
6767
showProgress: boolean;
6868
cwd: string;
69-
noExtract?: boolean;
69+
skipExtract?: boolean;
7070
dstFileName?: string;
7171
};
7272

73-
export async function downloadAndExtractFile(url: string, { cwd, noExtract, dstFileName }: DownloadAndExtractFile) {
73+
export async function downloadAndExtractFile(url: string, { cwd, skipExtract, dstFileName }: DownloadAndExtractFile) {
7474
const request = new Request(url, {
7575
headers: new Headers({
7676
'Content-Type': 'application/octet-stream',
@@ -101,11 +101,14 @@ export async function downloadAndExtractFile(url: string, { cwd, noExtract, dstF
101101
});
102102
});
103103

104-
if (noExtract) {
104+
if (skipExtract) {
105105
if (dstFileName) {
106106
fs.copyFileSync(savedFilePath, path.resolve(path.join(cwd, dstFileName)));
107107
} else {
108-
fs.copyFileSync(savedFilePath, cwd);
108+
// We still need some name for a file
109+
const tmpFileName = path.basename(savedFilePath);
110+
const destPath = path.join(cwd, tmpFileName);
111+
fs.copyFileSync(savedFilePath, destPath);
109112
}
110113
} else {
111114
await decompress(savedFilePath, cwd);

packages/cubejs-databricks-jdbc-driver/src/helpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export async function resolveJDBCDriver(): Promise<string> {
3636
* Extract if exist UID and PWD from URL and return UID, PWD and URL without these params
3737
* @param jdbcUrl
3838
*/
39-
export function extractAndRemoveUidPwdFromJdbcUrl(jdbcUrl: string): [string, string, string] {
40-
const uidMatch = jdbcUrl.match(/UID=([^;]*)/);
41-
const pwdMatch = jdbcUrl.match(/PWD=([^;]*)/);
39+
export function extractAndRemoveUidPwdFromJdbcUrl(jdbcUrl: string): [uid: string, pwd: string, cleanedUrl: string] {
40+
const uidMatch = jdbcUrl.match(/UID=([^;]*)/i);
41+
const pwdMatch = jdbcUrl.match(/PWD=([^;]*)/i);
4242

4343
const uid = uidMatch?.[1] || 'token';
4444
const pwd = pwdMatch?.[1] || '';

packages/cubejs-databricks-jdbc-driver/src/installer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function downloadJDBCDriver(): Promise<string | null> {
2121
{
2222
showProgress: true,
2323
cwd: path.resolve(path.join(__dirname, '..', 'download')),
24-
noExtract: true,
24+
skipExtract: true,
2525
dstFileName: `databricks-jdbc-${OSS_DRIVER_VERSION}-oss.jar`,
2626
}
2727
);

0 commit comments

Comments
 (0)