Fix a minor matching issue for google docs
This commit is contained in:
parent
4f7ec228d3
commit
9ff23622a0
|
@ -707,7 +707,7 @@ var Getters = {
|
|||
* Match [[anything]] and ignore whitespace
|
||||
* Fix 2014-08-07: [^] matches \r\n, . doesn't.
|
||||
*/
|
||||
var m = res.match(/(\[\s*\[[^\[][^]*?\]\s*\])/);
|
||||
var m = res.match(/\[(\[\s*\[[^\[][^]*?\]\s*\])/);
|
||||
try {
|
||||
var propertyList = JSON.parse(m[1]);
|
||||
var data = {};
|
||||
|
@ -751,7 +751,6 @@ var Getters = {
|
|||
|
||||
callback(null, new Media(id, title, seconds, "gd", { gpdirect: direct }));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return callback("Failed to parse Google Docs output", null);
|
||||
}
|
||||
});
|
||||
|
|
17
lib/safe-regex.js
Normal file
17
lib/safe-regex.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
var starHeightSafe = require("safe-regex");
|
||||
var parse = require("ret");
|
||||
|
||||
module.exports = function (re) {
|
||||
if (re.source) {
|
||||
re = re.source;
|
||||
}
|
||||
|
||||
if (!starHeightSafe(re)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var node = parse(re);
|
||||
console.log(require('util').inspect(node.stack));
|
||||
console.log(parse.types);
|
||||
return true;
|
||||
};
|
Loading…
Reference in a new issue