Merge pull request #14275 from edx/revert-14216-noraiz/TNL-6197

Revert "Error while exporting course with too long filename"
This commit is contained in:
noraiz-anwar
2017-01-10 16:01:55 +05:00
committed by GitHub
4 changed files with 4 additions and 58 deletions

View File

@@ -215,42 +215,6 @@ function($, _, Utils, _str) {
});
});
});
describe('Too long arguments ', function() {
var longFileName = (function() {
var text = '';
var possibleChars = 'abcdefghijklmnopqrstuvwxyz';
/* eslint vars-on-top: 0 */
for (var i = 0; i < 255; i++) {
text += possibleChars.charAt(Math.floor(Math.random() * possibleChars.length));
}
return text;
}()),
html5LongUrls = (function(videoName) {
var links = [
'http://somelink.com/%s?param=1&param=2#hash',
'http://somelink.com/%s#hash',
'http://somelink.com/%s?param=1&param=2',
'http://somelink.com/%s',
'ftp://somelink.com/%s',
'https://somelink.com/%s',
'https://somelink.com/sub/sub/%s',
'http://cdn.somecdn.net/v/%s',
'somelink.com/%s',
'%s'
];
return $.map(links, function(link) {
return _str.sprintf(link, videoName);
});
}(longFileName));
$.each(html5LongUrls, function(index, link) {
it(link, function() {
var result = Utils.parseHTML5Link(link);
expect(result.video.length).toBe(150);
});
});
});
});
it('Method: getYoutubeLink', function() {

View File

@@ -110,7 +110,6 @@ define(['jquery', 'underscore', 'jquery.ajaxQueue'], function($) {
*/
var _videoLinkParser = (function() {
var cache = {};
var maxVideoNameLength = 150;
return function(url) {
if (typeof url !== 'string') {
@@ -130,10 +129,7 @@ define(['jquery', 'underscore', 'jquery.ajaxQueue'], function($) {
match = link.pathname.match(/\/{1}([^\/]+)\.([^\/]+)$/);
if (match) {
cache[url] = {
/* avoid too long video name, as it will be used as filename for video's transcript
and a filename can not be more that 255 chars, limiting here to 150.
*/
video: match[1].slice(0, maxVideoNameLength),
video: match[1],
type: match[2]
};
} else {
@@ -143,7 +139,7 @@ define(['jquery', 'underscore', 'jquery.ajaxQueue'], function($) {
match = link.pathname.match(/\/{1}([^\/\.]+)$/);
if (match) {
cache[url] = {
video: match[1].slice(0, maxVideoNameLength),
video: match[1],
type: 'other'
};
}