Short urls 2 #93
2 changed files with 5 additions and 3 deletions
|
@ -195,10 +195,11 @@ module.exports = {
|
|||
let shortUrl;
|
||||
// 1. validate the claim id & retrieve the full claim id if needed
|
||||
getClaimIdandShortUrl(name, providedClaimId)
|
||||
.then(({ claimId, shortUrl }) => {
|
||||
.then(result => {
|
||||
// 2. check locally for the claim
|
||||
uri = `${name}#${claimId}`;
|
||||
return db.File.findOne({ where: { name, claimId } });
|
||||
uri = `${name}#${result.claimId}`;
|
||||
shortUrl = result.shortUrl;
|
||||
return db.File.findOne({ where: { name, claimId: result.claimId } });
|
||||
})
|
||||
.then(result => {
|
||||
// 3. if a match is found locally, serve that claim
|
||||
|
|
|
@ -105,6 +105,7 @@ module.exports = {
|
|||
.then(result => {
|
||||
claimId = url;
|
||||
shortUrl = result;
|
||||
logger.debug('short url', shortUrl);
|
||||
resolve({ claimId, shortUrl });
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
Loading…
Reference in a new issue