jupyterlab-contrib/jupyterlab-unfold

Cannot rename folders

ianhi opened this issue · 12 comments

ianhi commented

Description

It's impossible to rename folders
renaming-folders

Reproduce

  1. Open jupyterlab
  2. Try to rename an existing folder

Expected behavior

Folder is renamed

Context

  • Python package version: 0.1.6
  • Operating System and its version: Ubuntu 20.04
  • Browser and its version: Firefox 93.0
JupyterLab v3.2.2
/home/ian/mambaforge/envs/micro/share/jupyter/labextensions
        jupyterlab-unfold v0.1.6 enabled OK (python, jupyterlab-unfold)
        jupyterlab-vimrc v0.5.2 enabled OK
        jupyter-matplotlib v0.10.2 enabled OK
        @axlair/jupyterlab_vim v0.14.5 enabled OK (python, jupyterlab_vim)
        @lckr/jupyterlab_variableinspector v3.0.9 enabled OK (python, lckr_jupyterlab_variableinspector)
        @ryantam626/jupyterlab_code_formatter v1.4.10 enabled OK (python, jupyterlab-code-formatter)
        @telamonian/theme-darcula v3.1.1 enabled OK (python, theme-darcula)
        @jupyter-widgets/jupyterlab-manager v3.0.1 enabled OK (python, jupyterlab_widgets)
Command Line Output
[W 2021-11-15 17:25:24.621 ServerApp] Unknown error renaming file: Untitled Folder 1/Untitled Folder 1 [Errno 2] No such file or directory: '/home/ian/Documents/oss/tmp/Untitled Folder 1/Untitled Folder 1'
[E 2021-11-15 17:25:24.622 ServerApp] {
      "Host": "localhost:8886",
      "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0",
      "Accept": "*/*",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://localhost:8886/lab",
      "Content-Type": "text/plain;charset=UTF-8",
      "Authorization": "token 9e97d4e5422c8349cf05ed8fe7a6ecb5b1a7d3ef7f47501b",
      "X-Xsrftoken": "2|b3949570|68c9b6dc756c0f9684d21fa04e416a13|1635354133",
      "Origin": "http://localhost:8886",
      "Content-Length": "32",
      "Dnt": "1",
      "Connection": "keep-alive",
      "Cookie": "username-localhost-8890=\"2|1:0|10:1636399185|23:username-localhost-8890|44:NWJiMDk5YmJkMWExNDRhZWI4N2VhM2Y4Yjk3YmM1NjM=|cfe836e4c45c8c1fafecffcd0344081ba3de01322ec9b1c4be67b8469ebb490b\"; username-localhost-8888=\"2|1:0|10:1635825409|23:username-localhost-8888|44:YzhhM2Y1ZDMzNmQ5NDRjYmE0YjI2ZDgzNDMzNzYwNTg=|5658e9a9dd0c7a4dd24329d8fa393a31e8e9c328561c44a4bbed21754bbb2849\"; username-localhost-8889=\"2|1:0|10:1635807344|23:username-localhost-8889|44:M2Q2ZmMxZDBhMjNhNDc3ZjhhNTU5YTVkYWMxNmZlNzQ=|7ddf16768ce0925a3092d2be76a1dedaba5bd80a539d4da883d6e57bc0e8e717\"; _xsrf=2|b3949570|68c9b6dc756c0f9684d21fa04e416a13|1635354133; username-localhost-8891=\"2|1:0|10:1636493273|23:username-localhost-8891|44:YTg0NzJmNTdiY2VmNGE0MzhlYmQxZGI5ZmIyMDVhYzg=|e5de07f6344b77b8837f1a737a77c31b1b7b35a4d5eb9a276192c3ba388b4a45\"; username-localhost-8892=\"2|1:0|10:1636471953|23:username-localhost-8892|44:ZTg1NDZmODc2ZTZhNDE4YWJkOTdlYWZiMmQ2YTU5N2Y=|0ee0e755e3c73b920246841b7ee8b5f49774449cc980bfd7660008a4dcf0427a\"; username-localhost-8905=\"2|1:0|10:1636122516|23:username-localhost-8905|44:MTBlMGNjNWM3ZjI5NGQ1Njk2ZGY1YmEyODdhMDAxNmE=|040b76ba04bd931e3fc0bd843389765e7189d9c21417f88960945b6baa82f6bd\"; username-localhost-8916=\"2|1:0|10:1636123028|23:username-localhost-8916|44:YWRjNzUxZGRmNGI0NDIyOTgxNDhmYzEyMGU4MTNhNjY=|ace4edb7c59a01a279074231c6d06bd59d4626f0c219013167d7164441e2e8b7\"; username-localhost-8829=\"2|1:0|10:1636165271|23:username-localhost-8829|44:Y2I2YzUxZTE0OWY5NDU5ZWI1NjZmYTViOTAwM2MzYjU=|4df4f95f13c5a52b06cb49106805c7f4090e93a0856ecf6c1bff090d87b7b9d3\"; username-localhost-8885=\"2|1:0|10:1636163324|23:username-localhost-8885|44:ZGZhNWYyMWJiNjZhNDQ0ZGI0YTBlMjE5YmYwMmQ3YTA=|0d203b22db339956a200224ffc0dbedf6e49fd992793f872c529c54dd6e4de71\"; username-localhost-8914=\"2|1:0|10:1636164291|23:username-localhost-8914|44:MWNmNTg1MWNmMTNiNGY4ZWE3NDVmZTljNGFhYWNmZTA=|a45c078c525354f5dab9b3c08796156c01203cb381d6382d3bdf580daa928c31\"; username-localhost-8879=\"2|1:0|10:1636165308|23:username-localhost-8879|44:OWI1MDA0NWQ1Y2U1NDJmYTljYWUwNmZjNzBlYjU3MTY=|b0536fa602502a8136d7741c641b08a5be76e54536062e155af267b79b324d79\"; username-localhost-8932=\"2|1:0|10:1636228893|23:username-localhost-8932|44:YTM4NDQ5Yjg2NWNmNDViODk1Yzk0MDIxNjBhOWU2Yjg=|d62382ee2c63a7c6b05d119d6fda1a3c4e30f0e66be81424de1857ce57db2289\"; username-localhost-8826=\"2|1:0|10:1636322352|23:username-localhost-8826|44:ZGEyM2U2NTdmMzQ1NGQ1N2IxMmQ2ZDllZmRkZDE0ZTU=|74734fe4fb8f0df64759fa2f3a543802f91f2b7041057ec3360c6a903070309c\"; username-localhost-8987=\"2|1:0|10:1636322413|23:username-localhost-8987|44:ZmUwZmVjMDJiMDBlNDRhZTkxZjlkYmExNDExMTRiNzQ=|f1c456619319a108c9383368c2095c9559e21ea789c75250c29d962c75647f73\"; username-localhost-8845=\"2|1:0|10:1636322329|23:username-localhost-8845|44:MjAxMmU1OTU4NTUxNDcyMGIzOTAzNDQxYWZlYWZkOWY=|f298d6441fa44cf822607bbef4e218ffc8bcc5e72f35eee64be5dd2232381eae\"; username-localhost-8949=\"2|1:0|10:1636999176|23:username-localhost-8949|44:ZDBhNGQ1MjM4MzU4NDI4Mzk5YmQ2OWYxNzVkYWJkZmE=|a9d5bce820a8ee35818ac7f679175c20a3504c0dec3e03752729a0a1ef35556e\"; username-localhost-8809=\"2|1:0|10:1637015010|23:username-localhost-8809|44:YWE4MWM4NTYwYjRhNDZjMWEzY2E5MzY1N2RiYjQ4MGM=|a8d7764d5a0b4b572e0c1e622815d4a837dd99cf55f069c0ed448a8334ac1c04\"; username-localhost-8902=\"2|1:0|10:1636493277|23:username-localhost-8902|44:ZTgwYmM2NGEwZTczNDU1ZDgxOTZiYjFiMDJhOTRhNmM=|944a1703667c9bfbdb757538b28f54a2135175e3728102e3b6cf7f44bb4eb6ad\"; username-localhost-8925=\"2|1:0|10:1636482875|23:username-localhost-8925|44:MmFlOWU3MWYyNGM0NDZjOWIyYTYyZGYzYjE3Y2M4ODE=|80915eb66620cd4102010c185804886f6a6a0d1fbdceb6e01c3900e56a23b646\"; username-localhost-8811=\"2|1:0|10:1636575969|23:username-localhost-8811|44:ZDRjM2UyNTcwMWFkNDg0NmJkOTAyZjEwMjU0NTg2YTQ=|8c9c2af938b508b68f82ee80bbe5532839f4478b643e9985748e1bdd9e34a024\"; username-localhost-8927=\"2|1:0|10:1637008230|23:username-localhost-8927|44:OTQ4YzEzYTAxNDAyNGIyNWE2ZGUzNDNjNzBmMjU5NjY=|9d3c87242bb0d8ce620d634f703c624c8cc64a3e4623671bffdaadd6cbd30145\"; username-localhost-8820=\"2|1:0|10:1636743478|23:username-localhost-8820|44:ZDk1NTc3M2RiODllNDE2MWIwOWY4ZjgwNjMxYTJlNDc=|8c0628e4440f091426456e01f8200870a1df01f7b0247225ac1e5e20388d9208\"; username-localhost-8874=\"2|1:0|10:1636750679|23:username-localhost-8874|44:OWE5OGJiMzkyNzE1NGI1MWFhY2EwOWZjZTk5ZDVmYTE=|036a366eb619afcc1ab6c378dad8ddd2ecce504c0175b424a4ff89d9b60c297c\"; username-localhost-8952=\"2|1:0|10:1636750786|23:username-localhost-8952|44:NDYyMjYxZmFjODk2NDBlYmI4Yzk5MTJhYWI3MDFjMmY=|25a54fe7f9ad5439fb1146c30a4113f957b16acda513afca2705c280858e4737\"; username-localhost-8794=\"2|1:0|10:1637008504|23:username-localhost-8794|44:NDQyN2UzODg2NjRiNGVmYzk3OGEzN2YzZWNkNDk5MjA=|1e3a615422776cf301075d47d1f1d424b8274c5ee98c6f9051389fd1a24d29de\"; username-localhost-8945=\"2|1:0|10:1636999246|23:username-localhost-8945|44:NGM0ZTA1ZGVhZjg3NGNjYzg4ZjJkYTY0YWRlNDJjZjg=|af054b17bd05920d2144244e907d026fc7c4885de11c639a3f529708fa9f40ba\"; username-localhost-8886=\"2|1:0|10:1637015123|23:username-localhost-8886|44:ZTgwYjI2NWE2MjZhNGY1YWExNWY1YTU0NDkzNzBkYzY=|1c0be175fcdadc0d783af021aa2cebc9afb2de01b9238d5a018cff92a1e3709a\"",
      "Sec-Fetch-Dest": "empty",
      "Sec-Fetch-Mode": "cors",
      "Sec-Fetch-Site": "same-origin",
      "Sec-Gpc": "1",
      "Pragma": "no-cache",
      "Cache-Control": "no-cache"
    }
[E 2021-11-15 17:25:24.622 ServerApp] 500 PATCH /api/contents/Untitled%20Folder%201/Untitled%20Folder%201?1637015124616 (127.0.0.1) 1.46ms referer=http://localhost:8886/lab

Could it be related to the fact that there are spaces in the folder name?

ianhi commented

I don't think so? I can rename those in the normal file browser. Looking at the error it looks as though the folder name is being appended twice because maybe the root path is different than the core rename function expects?

ianhi commented

For example with a top level folder named folder-without-spaces an attempt to rename it gives this error:

Unknown error renaming file: folder-without-spaces/folder-without-spaces [Errno 2] No such file or directory: '/home/ian/Documents/oss/tmp/folder-without-spaces/folder-without-spaces'

image

ianhi commented

A related fun behavior:
Peek 2021-11-16 11-17

A related fun behavior:

😆 ok, that looks like your statement about the folder name appended twice is right

ianhi commented

Interestingly delete works just fine though

This is not limited to directories: if you create a new unnamed file via context menu, but an unnamed file already exists in parent directory it is the parent directory files which will get selected for rename-after-creation behaviour. I wonder if we could improve the rename upstream so that it selects based on the path and not based on the name?

@krassowski thanks for commenting. My PR in this repo #28 is not right, we should probably improve upstream instead, as you suggest.

Hi,
The same thing is happening to me, so my team won't be able to use this extension.
It would be fantastic if you could solve it quickly.

+1. Hope this could be resovled soon, this is a fantastic extension, thank you for your work!

Created this PR to work with JL 3.6.x. For other versions also, something similar has to be done, i.e. patch the corresponding rename method.