Skip to content

Commit

Permalink
Move MD5sum to the end of the dcf
Browse files Browse the repository at this point in the history
This is a workaround for bug in pak: r-universe-org/help#556
  • Loading branch information
jeroen committed Jan 7, 2025
1 parent 10a8ec7 commit 05c35b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion routes/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function(req, res, next){
res.set('Cache-Control', `public, max-age=60, stale-while-revalidate=${cdn_cache}`);

if(doc){
const revision = 3; // bump to invalidate all caches
const revision = 4; // bump to invalidate all caches
const etag = `W/"${doc._id}${revision}"`;
const date = new Date(doc._published.getTime() + revision * 1000).toUTCString();
res.set('ETag', etag);
Expand Down
3 changes: 2 additions & 1 deletion src/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ function unpack_deps(x){

export function doc_to_dcf(doc){
//this clones 'doc' and then deletes some fields
const { _id, _fileid, _type, Distro, ...x } = unpack_deps(doc);
const { _id, _fileid, _type, Distro, MD5sum, ...x } = unpack_deps(doc);
if(_type == 'linux'){
x.Platform = 'x86_64-pc-linux-gnu' //pak likes this to identify binaries
}
x.MD5sum = MD5sum; //workaround for https://github.com/r-lib/pak/issues/733
let keys = Object.keys(x);
return keys.map(function(key){
let val = x[key];
Expand Down

0 comments on commit 05c35b8

Please sign in to comment.