Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ export function activate() {

}

function isValidRegion(region: string): boolean {
// This regex allows for characters, numbers, and hyphens
const regionRegex = /^[a-zA-Z0-9-]+$/;
return regionRegex.test(region);
}

async function loadAndDisplayNotebook(fileKey: string, clusterId: string, region: string) {
if (!isValidRegion(region)) {
vscode.window.showErrorMessage('Invalid region format. Region should only contain characters, numbers, and hyphens.');
return;
}

const bucketName = `jumpstart-cache-prod-${region}`;
const url = `https://${bucketName}.s3.${region}.amazonaws.com/${fileKey}`;
try {
Expand Down
13 changes: 12 additions & 1 deletion patches/sagemaker-open-notebook-extension.patch
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-open-notebook-extension
===================================================================
--- /dev/null
+++ sagemaker-code-editor/vscode/extensions/sagemaker-open-notebook-extension/src/extension.ts
@@ -0,0 +1,80 @@
@@ -0,0 +1,91 @@
+
+import * as vscode from 'vscode';
+import * as https from 'https';
Expand All @@ -182,7 +182,18 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-open-notebook-extension
+
+}
+
+function isValidRegion(region: string): boolean {
+ // This regex allows for characters, numbers, and hyphens
+ const regionRegex = /^[a-zA-Z0-9-]+$/;
+ return regionRegex.test(region);
+}
+
+async function loadAndDisplayNotebook(fileKey: string, clusterId: string, region: string) {
+ if (!isValidRegion(region)) {
+ vscode.window.showErrorMessage('Invalid region format. Region should only contain characters, numbers, and hyphens.');
+ return;
+ }
+
+ const bucketName = `jumpstart-cache-prod-${region}`;
+ const url = `https://${bucketName}.s3.${region}.amazonaws.com/${fileKey}`;
+ try {
Expand Down
Loading