OCA_Backend/api/node_modules/validator/es/lib/isMagnetURI.js

6 lines
293 B
JavaScript
Raw Permalink Normal View History

2022-01-22 13:36:44 +00:00
import assertString from './util/assertString';
var magnetURI = /^magnet:\?xt(?:\.1)?=urn:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?($|&)/i;
export default function isMagnetURI(url) {
assertString(url);
return magnetURI.test(url.trim());
}