Environment
|
|
| Operating system |
Windows 10.0.26200 |
| CPU |
11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 cores) |
| Node.js version |
v24.15.0 |
| nuxt/cli version |
3.36.1 |
| Package manager |
npm@11.12.1 |
| Nuxt version |
4.4.8 |
| Nitro version |
2.13.4 |
| Builder |
vite@7.3.6 |
| Config |
compatibilityDate, content, devtools, modules |
| Modules |
@nuxt/content@3.15.0 |
Version
3.15.0
Reproduction
I think the issue is obvious and the below description is enough to understand the problem and solution.
Description
Hello,
When I define a collection source where the repository property is a url string that ends in .git like so:
source: {
repository: 'https://git.domain.tld/repo.git',
include: '**/*.json',
},
npm run dev throws a ERROR HTTP Error: 404 Not Found. I think it is because you don't add back the .git suffix when transforming the repository property from a string into an object (line 65-68 below):
|
export function defineGitSource(source: CollectionSource): ResolvedCollectionSource { |
|
const resolvedSource = defineLocalSource(source) |
|
resolvedSource.prepare = async ({ rootDir }) => { |
|
if (typeof (source.repository) === 'string') { |
|
const repository = source?.repository && gitUrlParse(source.repository) |
|
if (repository) { |
|
const { protocol, host, full_name, ref } = repository |
|
source = { |
|
...source, |
|
repository: { |
|
url: `${protocol}://${host}/${full_name}`, |
|
branch: ref || 'main', |
|
}, |
|
} |
|
} |
|
} |
As a workaround, I can define my collection source repository as an object instead of a string like so:
source: {
repository: {
url: 'https://git.domain.tld/repo.git',
branch: 'main',
},
},
Additional context
No response
Logs
Environment
Windows 10.0.2620011th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 cores)v24.15.03.36.1npm@11.12.14.4.82.13.4vite@7.3.6compatibilityDate,content,devtools,modules@nuxt/content@3.15.0Version
3.15.0
Reproduction
I think the issue is obvious and the below description is enough to understand the problem and solution.
Description
Hello,
When I define a collection source where the repository property is a url string that ends in
.gitlike so:npm run devthrows aERROR HTTP Error: 404 Not Found. I think it is because you don't add back the.gitsuffix when transforming therepositoryproperty from astringinto anobject(line 65-68 below):content/src/utils/source.ts
Lines 56 to 71 in d8fed0c
As a workaround, I can define my collection source repository as an object instead of a string like so:
Additional context
No response
Logs