ImagesTable: ensure local target is copyable
To ensure the local file target is copyable and usable in `cockpit-files`, the artefact directory needs to be readable.
This commit is contained in:
parent
eac03ddc7d
commit
1b4ecdb271
1 changed files with 8 additions and 3 deletions
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue