1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 23:09:41 +02:00

fix(podman): create new image from a container in podman [r8s-90] (#347)

This commit is contained in:
Ali 2025-02-05 20:22:33 +13:00 committed by GitHub
parent 5423a2f1b9
commit 371e84d9a5
6 changed files with 37 additions and 10 deletions

View file

@ -16,6 +16,24 @@ describe('fullURIIntoRepoAndTag', () => {
expect(result).toEqual({ repo: 'nginx', tag: 'latest' });
});
it('splits image-repo:port/image correctly', () => {
const result = fullURIIntoRepoAndTag('registry.example.com:5000/my-image');
expect(result).toEqual({
repo: 'registry.example.com:5000/my-image',
tag: 'latest',
});
});
it('splits image-repo:port/image:tag correctly', () => {
const result = fullURIIntoRepoAndTag(
'registry.example.com:5000/my-image:v1'
);
expect(result).toEqual({
repo: 'registry.example.com:5000/my-image',
tag: 'v1',
});
});
it('splits registry:port/image-repo:tag correctly', () => {
const result = fullURIIntoRepoAndTag(
'registry.example.com:5000/my-image:v2.1'

View file

@ -121,9 +121,18 @@ export function fullURIIntoRepoAndTag(fullURI: string) {
// - registry/image-repo:tag
// - image-repo:tag
// - registry:port/image-repo:tag
// - localhost:5000/nginx
// buildImageFullURIFromModel always gives a tag (defaulting to 'latest'), so the tag is always present after the last ':'
const parts = fullURI.split(':');
const tag = parts.pop() || 'latest';
// handle the case of a repo with a non standard port
if (tag.includes('/')) {
return {
repo: fullURI,
tag: 'latest',
};
}
const repo = parts.join(':');
return {
repo,