mirror of
https://github.com/imputnet/cobalt.git
synced 2026-10-24 02:52:18 +00:00
Use username in author media folder names
This commit is contained in:
parent
ae1fb91382
commit
bc65ef8630
2 changed files with 5 additions and 4 deletions
|
|
@ -24,8 +24,9 @@ describe('media path naming', () => {
|
|||
expect(folder).not.toMatch(/[<>:"/\\|?*]/);
|
||||
});
|
||||
|
||||
it('builds the author folder from display name and user ID', () => {
|
||||
expect(buildAuthorFolder({ authorName: 'A/B', userId: '42' }, 'fallback')).toBe('A_B_42');
|
||||
it('builds the author folder from display name and username', () => {
|
||||
expect(buildAuthorFolder({ authorName: 'A/B', username: 'animal_kyawa_' }, 'fallback'))
|
||||
.toBe('A_B@animal_kyawa_');
|
||||
});
|
||||
|
||||
it.each([
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ export function formatPublishedDate(isoDate: string | undefined): string {
|
|||
return `${values.year}-${values.month}-${values.day}`;
|
||||
}
|
||||
|
||||
export function buildAuthorFolder(metadata: Pick<PostMetadata, 'authorName' | 'userId'>, fallback: string): string {
|
||||
return sanitizePathSegment(`${metadata.authorName}_${metadata.userId}`, fallback);
|
||||
export function buildAuthorFolder(metadata: Pick<PostMetadata, 'authorName' | 'username'>, fallback: string): string {
|
||||
return sanitizePathSegment(`${metadata.authorName}@${metadata.username}`, fallback);
|
||||
}
|
||||
|
||||
export function buildPostFolder(metadata: Pick<PostMetadata, 'publishedAt' | 'text'> | undefined, tweetId: string): string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue