Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #41 from fengmk2/download404
Browse files Browse the repository at this point in the history
ignore 404 on sync. fixed #39
  • Loading branch information
dead-horse committed Dec 10, 2013
2 parents fc65b95 + c25fda1 commit c511f87
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion controllers/registry/sync_module_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ SyncModuleWorker.prototype._syncOneVersion = function (versionIndex, sourcePacka
var dataSize = 0;
urllib.request(downurl, options, ep.done(function (_, response) {
var statusCode = response && response.statusCode || -1;
if (statusCode === 404) {
// just copy source dist
shasum = sourcePackage.dist.shasum;
return ep.emit('uploadResult', {
url: downurl
});
}

if (statusCode !== 200) {
var err = new Error('Download ' + downurl + ' fail, status: ' + statusCode);
err.name = 'DownloadTarballError';
Expand Down Expand Up @@ -288,7 +296,8 @@ SyncModuleWorker.prototype._syncOneVersion = function (versionIndex, sourcePacka
var dist = {
tarball: result.url,
shasum: shasum,
size: dataSize
size: dataSize,
noattachment: dataSize === 0,
};
mod.package.dist = dist;

Expand Down

0 comments on commit c511f87

Please sign in to comment.