Skip to content

Commit

Permalink
Fix sync size max (#1716)
Browse files Browse the repository at this point in the history
Closes #1715

Auto-merge
  • Loading branch information
Martii authored Apr 12, 2020
1 parent 199d8c9 commit 9955df3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions libs/repoManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var Strategy = require('../models/strategy').Strategy;

var nil = require('./helpers').nil;
var github = require('../libs/githubClient');
var settings = require('../models/settings.json');


var clientId = null;
var clientKey = null;
Expand Down Expand Up @@ -121,12 +123,16 @@ RepoManager.prototype.loadScripts = function (aUpdate, aCallback) {
var url = '/' + encodeURI(aRepo.user) + '/' + encodeURI(aRepo.repo)
+ '/master' + aScript.path;
fetchRaw('raw.githubusercontent.com', url, function (aBufs) {
scriptStorage.getMeta(aBufs, function (aMeta) {
if (aMeta) {
scriptStorage.storeScript(that.user, aMeta, Buffer.concat(aBufs), aUpdate,
aInnerCallback);
}
});
var thisBuf = Buffer.concat(aBufs);

if (thisBuf.byteLength <= settings.maximum_upload_script_size) {
scriptStorage.getMeta(aBufs, function (aMeta) {
if (aMeta) {
scriptStorage.storeScript(that.user, aMeta, thisBuf, aUpdate,
aInnerCallback);
}
});
}
});
}, aCallback);
});
Expand Down

0 comments on commit 9955df3

Please sign in to comment.