Skip to content

Commit 047720c

Browse files
rewrite direct github data file url (#99)
1 parent 93eef46 commit 047720c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/commands/openDataFile.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export async function registerOpenDataFileCommand(context: ExtensionContext) {
2222
prompt: 'Enter Data File Url for Table View'
2323
}).then((dataFileUrl: string | undefined) => {
2424
if (dataFileUrl && dataFileUrl !== undefined && dataFileUrl.length > 0) {
25+
if (dataFileUrl.startsWith('https://github.com')) {
26+
// rewrite github data url to use raw.githubusercontent
27+
dataFileUrl = dataFileUrl.replace('https://github.com/', 'https://raw.githubusercontent.com/');
28+
dataFileUrl = dataFileUrl.replace('/blob/', '/'); // strip out blob part
29+
}
30+
2531
// create data file Uri
2632
const dataFileUri: Uri = Uri.parse(dataFileUrl);
2733

0 commit comments

Comments
 (0)