Skip to content

Commit

Permalink
ImagesTable: ensure local target is copyable
Browse files Browse the repository at this point in the history
To ensure the local file target is copyable and usable in
`cockpit-files`, the artefact directory needs to be readable.
  • Loading branch information
croissanne authored and regexowl committed Feb 3, 2025
1 parent eac03dd commit 1b4ecdb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Components/ImagesTable/Instance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,20 @@ export const LocalInstance = ({ compose }: LocalInstancePropTypes) => {
return <></>;
}

const href =
'/files#/?path=' + encodeURIComponent(path.parse(options?.filename).dir);
const parsedPath = path.parse(options?.filename);
const href = '/files#/?path=' + encodeURIComponent(parsedPath.dir);
return (
<Button
component="a"
target="_blank"
variant="link"
onClick={(ev) => {
onClick={async (ev) => {
ev.preventDefault();
// Make sure the file is readable for the user, the artefact
// directory is created as 700 by default.
await cockpit.spawn(['chmod', '755', parsedPath.dir], {
superuser: 'try',
});
cockpit.jump(href, cockpit.transport.host);
}}
href={href}
Expand Down

0 comments on commit 1b4ecdb

Please sign in to comment.