tangled
alpha
login
or
join now
stevedylan.dev
/
sequoia
A CLI for publishing standard.site documents to ATProto
sequoia.pub
standard
site
lexicon
cli
publishing
30
fork
atom
overview
issues
5
pulls
1
pipelines
fix: asset subdirectories
stevedylan.dev
5 days ago
ae704905
64d3fa00
1/1
lint.yml
success
5s
+21
-2
1 changed file
expand all
collapse all
unified
split
packages
cli
src
lib
atproto.ts
+21
-2
packages/cli/src/lib/atproto.ts
···
190
190
contentDir: string,
191
191
): Promise<string | null> {
192
192
// Try multiple resolution strategies
193
193
-
const filename = path.basename(ogImage);
194
193
195
194
// 1. If imagesDir is specified, look there
196
195
if (imagesDir) {
197
197
-
const imagePath = path.join(imagesDir, filename);
196
196
+
// Get the base name of the images directory (e.g., "blog-images" from "public/blog-images")
197
197
+
const imagesDirBaseName = path.basename(imagesDir);
198
198
+
199
199
+
// Check if ogImage contains the images directory name and extract the relative path
200
200
+
// e.g., "/blog-images/other/file.png" with imagesDirBaseName "blog-images" -> "other/file.png"
201
201
+
const imagesDirIndex = ogImage.indexOf(imagesDirBaseName);
202
202
+
let relativePath: string;
203
203
+
204
204
+
if (imagesDirIndex !== -1) {
205
205
+
// Extract everything after "blog-images/"
206
206
+
const afterImagesDir = ogImage.substring(
207
207
+
imagesDirIndex + imagesDirBaseName.length,
208
208
+
);
209
209
+
// Remove leading slash if present
210
210
+
relativePath = afterImagesDir.replace(/^[/\\]/, "");
211
211
+
} else {
212
212
+
// Fall back to just the filename
213
213
+
relativePath = path.basename(ogImage);
214
214
+
}
215
215
+
216
216
+
const imagePath = path.join(imagesDir, relativePath);
198
217
if (await fileExists(imagePath)) {
199
218
const stat = await fs.stat(imagePath);
200
219
if (stat.size > 0) {