HTML dump: Tries to re-create subdirectory that is already a file: FileExistsError
sebix opened this issue · 2 comments
sebix commented
Preconditions (example)
- Create a subpage, e.g
Home/Sub
- Add an attachment, e.g.
Home/Sub/doc.pdf
- run
moin dump-html
2024-08-23 11:56:43,794 INFO moin.cli.maint.dump_html:98 Dump html started
Creating output directory /dev/moin/HTML, starting to copy supporting files
Starting to dump items
2024-08-23 11:56:44,163 INFO moin.signalling.log:20 item MyMoinMoin:Home displayed
Saved file named /dev/moin/HTML/Home.html
2024-08-23 11:56:44,272 INFO moin.signalling.log:20 item MyMoinMoin:Home/Sub displayed
Saved file named /dev/moin/HTML/Home/Sub
2024-08-23 11:56:44,325 INFO moin.signalling.log:20 item MyMoinMoin:Home/Sub/doc.pdf displayed
Traceback (most recent call last):
File "/dev/moin-venv-python/bin/moin", line 8, in <module>
sys.exit(cli())
^^^^^
File "/dev/moin-venv-python/lib64/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dev/moin-venv-python/lib64/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/dev/moin-venv-python/lib64/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dev/moin-venv-python/lib64/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dev/moin-venv-python/lib64/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dev/moin-venv-python/lib64/python3.11/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dev/moin-venv-python/lib64/python3.11/site-packages/flask/cli.py", line 386, in decorator
return ctx.invoke(f, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dev/moin-venv-python/lib64/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dev/moin/src/moin/cli/maint/dump_html.py", line 217, in Dump
os.makedirs(os.path.dirname(full_file_name), exist_ok=True)
File "<frozen os>", line 225, in makedirs
FileExistsError: [Errno 17] File exists: '/dev/moin/HTML/+get/Home/Sub'
sebix commented
The problem is, that HTML/+get/Home/Sub
is already a text file (containing the page as source, unrendered)
UlrichB22 commented
I can reproduce the issue. The cause is that make_flat_index() in items/init.py does not report Home/sub as a directory.
This can also be seen in the index:
In general, the problem of nodes (items with subitems) is solved by adding '.html' to the itemname. Therefore, the name should not collide with the directory name.
I will raise a PR.