Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Patch data route pathing (#75)
Browse files Browse the repository at this point in the history
* Added sync route, cache offset param

* Patch data route pathing
  • Loading branch information
TheLoneRonin authored May 26, 2021
1 parent eab7932 commit 283bcba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arweave/gateway",
"version": "0.11.1",
"version": "0.11.2",
"main": "dist/src/Gateway.js",
"repository": "[email protected]:ArweaveTeam/gateway.git",
"author": "Arweave <[email protected]>",
Expand Down
7 changes: 4 additions & 3 deletions src/route/data.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {exists} from 'fs-jetpack';
import {Request, Response} from 'express';
import {stringToBip39, stringToHash} from '../utility/bip39.utility';
import {transaction as getTransaction, tagValue} from '../query/transaction.query';
import {cacheFile, cacheAnsFile} from '../caching/file.caching';
import {cacheFolder, cacheFile, cacheAnsFile} from '../caching/file.caching';


export const dataRouteRegex = /^\/?([a-zA-Z0-9-_]{43})\/?$|^\/?([a-zA-Z0-9-_]{43})\/(.*)$/i;
export const pathRegex = /^\/?([a-z0-9-_]{43})/i;
Expand Down Expand Up @@ -48,9 +49,9 @@ export async function dataRoute(req: Request, res: Response) {

}

if (exists(`${process.cwd()}/cache/tx/${transaction}`)) {
if (exists(`${cacheFolder}/${transaction}`)) {
res.status(200);
res.sendFile(`${process.cwd()}/cache/tx/${transaction}`);
res.sendFile(`${cacheFolder}/${transaction}`);
} else {
res.status(500);
res.json({status: 'ERROR', message: 'Could not retrieve transaction'});
Expand Down

0 comments on commit 283bcba

Please sign in to comment.