Skip to content

Commit

Permalink
abs path support
Browse files Browse the repository at this point in the history
  • Loading branch information
wassfila committed Jun 10, 2024
1 parent fbd8a5c commit b47588b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@google/model-viewer": "^3.4.0",
"@svgdotjs/svg.js": "^3.1.2",
"astro": "^4.5.10",
"astro": "^4.10.1",
"content-structure": "^1.1.8",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
Expand Down
2 changes: 0 additions & 2 deletions pnpm-workspace.yaml

This file was deleted.

10 changes: 4 additions & 6 deletions src/pages/assets/[...path].js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ export async function GET({params,props}){
let imagePath = resolve(join(config.content_path,params.path));
imagePath = remove_base(imagePath)
if(params.path.startsWith("/")){
if(props.exists_in_public == "true"){
const asset = props.asset
if(asset.exists){
//only if it exists in public do this :
imagePath = props.abs_path
imagePath = asset.abs_path
//let public_path = resolve(join(config.rootdir,"public",params.path));
//public_path = remove_base(public_path)
//console.log(`assets> checking if path exists ${public_path}`)
Expand Down Expand Up @@ -47,9 +48,6 @@ export async function getStaticPaths(){
console.log(`serving API endpoit ${assets.length} assets`)
return assets.map((asset)=>({
params:{path:asset.path},
props:{
exists_in_public:asset.exists?"true":"false",
abs_path:Object.hasOwn(asset,"abs_path")?asset.abs_path:""
}
props:{asset}
}))
}

0 comments on commit b47588b

Please sign in to comment.