bug-librejs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-librejs] isFreeLicensed breaks external scripts


From: Jookia
Subject: [Bug-librejs] isFreeLicensed breaks external scripts
Date: Tue, 2 Jun 2015 13:05:45 +1000

Hello,

The latest commit (9b79c2a61be72965c001c8d9779a7b3188628613) makes the code use
the 'isFreeLicensed' function for external scripts. The function in question:

    JsChecker.prototype.isFreeLicensed = function(script) {
        var magnets = '(' +
            
'magnet:\\?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt|' +
            
'magnet:\\?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt|'
 +
            
'magnet:\\?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt|'
 +
            
'magnet:\\?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt|'
 +
            
'magnet:\\?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&dn=lgpl-2.1.txt|'
 +
            
'magnet:\\?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&dn=lgpl-3.0.txt|'
 +
            
'magnet:\\?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt|'
 +
            
'magnet:\\?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&dn=bsd-3-clause.txt|'
 +
            
'magnet:\\?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt|'
 +
            
'magnet:\\?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt|' +
            
'magnet:\\?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt|' +
            
'magnet:\\?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&dn=xfree86.txt|'
 +
            
'magnet:\\?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&dn=freebsd.txt|'
 +
            
'magnet:\\?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&dn=ISC.txt|' +
            
'magnet:\\?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&dn=artistic-2.0.txt|'
 +
            
'magnet:\\?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt'
 +
            ')';
    
        // Remove licensed parts
        var re = new RegExp(
            '@license +' + magnets + '.*([\n\r].*?)address@hidden', 'g');
        script = script.replace(re, '');
    
        // Remove comments and empty lines
        re = new RegExp('\/\/.*|/\\*.*?\\*/|^\s*[\n\r]*', 'gm');
    
        script = script.replace(re, "");
    
        // If only spaces remain, the file has a free license
        return (script.match(/\S/) === null);
    };

As a result external scripts that don't use magnet links or have a single
license header at the start rather than the @license and @license-end syntax
won't get loaded as they're marked as nonfree.

Cheers,
Jookia.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]