giget icon indicating copy to clipboard operation
giget copied to clipboard

Possibility to individualize unpacking (Azure Devops)

Open Ayax0 opened this issue 1 year ago • 0 comments

Describe the feature

I have tried to implement a custom provider for Azure Devops. My code looks like this:

const devops: TemplateProvider = async (input, { auth }) => {
	const match =
		input.match(
			/^(?<org>[\w.-]+)\/(?<proj>[\w. ]+)\/(?<repo>[\w.]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/,
		)?.groups || {};

	return {
		name: "devops",
		version: input,
		headers: { authorization: Buffer.from(`:${auth}`).toString("base64") },
		url: `https://dev.azure.com/${match.org}/${match.proj}/_git/${match.repo}?path=${match.subdir || "/"}&version=GB${match.ref ? match.ref.slice(1) : "main"}`,
		tar: `https://dev.azure.com/${match.org}/${match.proj}/_apis/git/repositories/${match.repo}/items/items?path=${match.subdir || "/"}&versionDescriptor[version]=${match.ref ? match.ref.slice(1) : "main"}&resolveLfs=true&$format=zip&download=true`,
	};
};

The problem is that Devops only allows a download as a zip file. So the download fails because a tar.gz file is expected.

It would be good if, for example, a separate unpacking callback function could be provided by the provider so that an alternative unpacking function can be used in this case.

Additional information

  • [X] Would you be willing to help implement this feature?

Ayax0 avatar Oct 14 '24 09:10 Ayax0