Skip to content

Commit 6f02039

Browse files
committed
fix(pages): do not treat directories as files
Signed-off-by: Michael Adler <michael.adler@siemens.com>
1 parent 5e1df1d commit 6f02039

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

hugo/filters/fix-links-pre.lua

+16-7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ local link_rewrites = {
3232
["../contrib/config-deployment/wfx.workflow.config.deployment.yml"] = "https://github.com/siemens/wfx/tree/main/contrib/config-deployment/wfx.workflow.config.deployment.yml",
3333
["../contrib/config-deployment/README.md"] = "https://github.com/siemens/wfx/tree/main/contrib/config-deployment",
3434
["../contrib/config-deployment/client/worker.go"] = "https://github.com/siemens/wfx/tree/main/contrib/config-deployment/client/worker.go",
35+
["../fbs"] = "https://github.com/siemens/wfx/tree/main/fbs",
36+
["../example/plugin"] = "https://github.com/siemens/wfx/tree/main/example/plugin",
3537
}
3638

3739
local function find_git_root()
@@ -50,18 +52,25 @@ local function copy_file(from, to)
5052
if not f then
5153
error(string.format("ERROR: source %s does not exist", from))
5254
end
55+
56+
local block = f:read(4096)
57+
if not block then
58+
logging.info("Skipping ", from, " because it is not a readable file")
59+
f:close()
60+
return
61+
end
62+
63+
5364
local t = io.open(to, "wb")
5465
if not t then
55-
error(string.format("ERROR: destination %s does not exist", to))
66+
error(string.format("ERROR: Cannot create destination %s", to))
5667
end
5768

58-
while true do
59-
local block = f:read(4096)
60-
if not block then
61-
break
62-
end
69+
repeat
6370
t:write(block)
64-
end
71+
block = f:read(4096)
72+
until block == nil
73+
6574
f:close()
6675
t:close()
6776
end

0 commit comments

Comments
 (0)