Short urls 2 #93

Merged
bones7242 merged 8 commits from short-urls-2 into master 2017-07-20 08:16:30 +02:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit db1813cd08 - Show all commits

View file

@ -195,10 +195,11 @@ module.exports = {
let shortUrl; let shortUrl;
// 1. validate the claim id & retrieve the full claim id if needed // 1. validate the claim id & retrieve the full claim id if needed
getClaimIdandShortUrl(name, providedClaimId) getClaimIdandShortUrl(name, providedClaimId)
.then(({ claimId, shortUrl }) => { .then(result => {
// 2. check locally for the claim // 2. check locally for the claim
uri = `${name}#${claimId}`; uri = `${name}#${result.claimId}`;
return db.File.findOne({ where: { name, claimId } }); shortUrl = result.shortUrl;
return db.File.findOne({ where: { name, claimId: result.claimId } });
}) })
.then(result => { .then(result => {
// 3. if a match is found locally, serve that claim // 3. if a match is found locally, serve that claim

View file

@ -105,6 +105,7 @@ module.exports = {
.then(result => { .then(result => {
claimId = url; claimId = url;
shortUrl = result; shortUrl = result;
logger.debug('short url', shortUrl);
resolve({ claimId, shortUrl }); resolve({ claimId, shortUrl });
}) })
.catch(error => { .catch(error => {