|
From: <tob...@us...> - 2014-02-28 00:21:12
|
Revision: 7898
http://sourceforge.net/p/bigdata/code/7898
Author: tobycraig
Date: 2014-02-28 00:21:09 +0000 (Fri, 28 Feb 2014)
Log Message:
-----------
#820 - Allow HTTP[S] paths as well as file paths
Modified Paths:
--------------
branches/RDR/bigdata-war/src/html/workbench.js
Modified: branches/RDR/bigdata-war/src/html/workbench.js
===================================================================
--- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-27 23:42:09 UTC (rev 7897)
+++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-28 00:21:09 UTC (rev 7898)
@@ -196,9 +196,15 @@
text = text.toUpperCase();
if(considerPath) {
- // match Unix or Windows paths
- var re = /^(((\/[^\/]+)+)|([A-Z]:([\\\/][^\\\/]+)+))$/;
- if(re.test(text.trim())) {
+ // match Unix, Windows or HTTP paths
+ // file:// is optional for local paths
+ // when file:// is not present, Windows paths may use \ or / and must include a :
+ // when file:// is present, Windows paths must use / and may include a :
+ // http[s]:// is mandatory for HTTP paths
+ var unix = /^(file:\/\/)?((\/[^\/]+)+)$/;
+ var windows = /^((file:\/\/)([A-Za-z]:?([\/][^\/\\]+)+))|([A-Za-z]:([\\\/][^\\\/]+)+)$/;
+ var http = /^https?:\/((\/[^\/]+)+)$/;
+ if(unix.test(text.trim()) || windows.test(text.trim()) || http.test(text.trim())) {
return 'path';
}
}
@@ -288,7 +294,11 @@
settings.contentType = rdf_content_types[type];
break;
case 'path':
- settings.data = 'uri=file://' + encodeURIComponent(settings.data);
+ // if no scheme is specified, assume a local path
+ if(!/^(file|(https?)):\/\//.test(settings.data)) {
+ settings.data = 'file://' + settings.data;
+ }
+ settings.data = 'uri=' + encodeURIComponent(settings.data);
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|