A CLI for publishing standard.site documents to ATProto sequoia.pub
standard site lexicon cli publishing

Fix Asset Subdirectories #12

merged opened by stevedylan.dev targeting main from fix/asset-subdirectories
  • Small fix to support subdirectories for asset folders
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:ia2zdnhjaokf5lazhxrmj6eu/sh.tangled.repo.pull/3mdzwa2fca222
+21 -2
Diff #0
+21 -2
packages/cli/src/lib/atproto.ts
··· 190 contentDir: string, 191 ): Promise<string | null> { 192 // Try multiple resolution strategies 193 - const filename = path.basename(ogImage); 194 195 // 1. If imagesDir is specified, look there 196 if (imagesDir) { 197 - const imagePath = path.join(imagesDir, filename); 198 if (await fileExists(imagePath)) { 199 const stat = await fs.stat(imagePath); 200 if (stat.size > 0) {
··· 190 contentDir: string, 191 ): Promise<string | null> { 192 // Try multiple resolution strategies 193 194 // 1. If imagesDir is specified, look there 195 if (imagesDir) { 196 + // Get the base name of the images directory (e.g., "blog-images" from "public/blog-images") 197 + const imagesDirBaseName = path.basename(imagesDir); 198 + 199 + // Check if ogImage contains the images directory name and extract the relative path 200 + // e.g., "/blog-images/other/file.png" with imagesDirBaseName "blog-images" -> "other/file.png" 201 + const imagesDirIndex = ogImage.indexOf(imagesDirBaseName); 202 + let relativePath: string; 203 + 204 + if (imagesDirIndex !== -1) { 205 + // Extract everything after "blog-images/" 206 + const afterImagesDir = ogImage.substring( 207 + imagesDirIndex + imagesDirBaseName.length, 208 + ); 209 + // Remove leading slash if present 210 + relativePath = afterImagesDir.replace(/^[/\\]/, ""); 211 + } else { 212 + // Fall back to just the filename 213 + relativePath = path.basename(ogImage); 214 + } 215 + 216 + const imagePath = path.join(imagesDir, relativePath); 217 if (await fileExists(imagePath)) { 218 const stat = await fs.stat(imagePath); 219 if (stat.size > 0) {

History

1 round 0 comments
sign up or login to add to the discussion
stevedylan.dev submitted #0
1 commit
expand
fix: asset subdirectories
1/1 success
expand
expand 0 comments
pull request successfully merged