Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert “Unable to create new file from template” #26672

Closed
qibao07 opened this issue Apr 21, 2021 · 34 comments · Fixed by #28872
Closed

Alert “Unable to create new file from template” #26672

qibao07 opened this issue Apr 21, 2021 · 34 comments · Fixed by #28872

Comments

@qibao07
Copy link

qibao07 commented Apr 21, 2021

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Open the left menu "Favorites".(左侧菜单“收藏”)
  2. Right click any file and click "view in folder".(右键任意文件,点击“在文件夹中查看”)
  3. Click "New text document" in current position.(当前位置点击“新建文本文档”)

图片展示

1618974862354

Expected behaviour

New text document.(新建文本文档)

Actual behaviour

Alert “Unable to create new file from template”.(提示“无法从模板创建新文件”)

启动脚本

#!/bin/bash

set -ex

VERSION=21.0.1

docker pull nextcloud:$VERSION
docker rm -f my-nextcloud
docker run -d --name my-nextcloud \
  -v /home/ubuntu/MyDisk2/nextcloud:/var/www/html \
  --restart always \
  -p 57202:80 \
  nextcloud:$VERSION
docker cp sources.list my-nextcloud:/etc/apt/sources.list
docker exec -it my-nextcloud bash -c "apt update && apt install -y smbclient libmagickcore-6.q16-6-extra"
docker image prune -a -f

Server configuration

Operating system: ubuntu

Web server:

Database:

PHP version:

Nextcloud version: 21.0.1 (see Nextcloud admin page)

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from: docker hub

@qibao07 qibao07 added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Apr 21, 2021
@wiswedel

This comment has been minimized.

@qibao07

This comment has been minimized.

@solracsf solracsf changed the title 从“收藏”右键任意文件点击“在文件夹查看”,新建文本文档提示“无法从模板创建新文件” Alert “Unable to create new file from template” Apr 22, 2021
@szaimen

This comment has been minimized.

@qibao07

This comment has been minimized.

@szaimen

This comment has been minimized.

@qibao07
Copy link
Author

qibao07 commented May 26, 2021

So then please report back after you've upgraded to NC21.0.2, thanks! :)

I upgraded to NC21.0.2, but the bug has not been fixed.

@szaimen

This comment has been minimized.

@szaimen szaimen added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap needs info labels May 31, 2021
@juliusknorr

This comment has been minimized.

@szaimen szaimen added 0. Needs triage Pending check for reproducibility or if it fits our roadmap needs info and removed 1. to develop Accepted and waiting to be taken care of labels Jul 14, 2021
@qibao07
Copy link
Author

qibao07 commented Jul 15, 2021

Anything in the Nextcloud log file related to the failure?

On the demo website(https://try.nextcloud.com/),this problem is easy to reproduce.

@ghost

This comment has been minimized.

@ghost ghost added the stale Ticket or PR with no recent activity label Aug 14, 2021
@qibao07

This comment has been minimized.

@ghost ghost removed the stale Ticket or PR with no recent activity label Aug 14, 2021
@Jesse-Ma
Copy link

你的那些文件是不是用命令 scan 出来的. 看一下数据的文件夹及其子文件夹的owner 是不是有问题. 一般都是www-data

@qibao07
Copy link
Author

qibao07 commented Aug 28, 2021

  • 首先,在官网体验网页https://try.nextcloud.com/也可以重现该问题
  • 其次,我的文件权限如下
    image
  • 最后,不明白你说的scan命令是指什么,我只是正常通过页面使用nextcloud
  • 问题所在,仅通过上述操作,进入相应目录,创建文件时通过浏览器debug可看出,参数里没有正确路径
    image
    @Jesse-Ma

@slater0013
Copy link

Hello,

Nextcloud 21.0.4 hosted on Debian 10.

Same bug here but not 100% reproductible ! Sometimes the file creation process goes well.

The difference is in the POST payload, the filePath is sometimes incorrect :

{
    "filePath": "/null/dguherz.md"
}

Tested on Chrome & Firefox (last versions) on Windows 10 et Mac OS X.

Regards,
GS.

@slater0013
Copy link

Hello,

Nextcloud 21.0.4 hosted on Debian 10.

Same bug here but not 100% reproductible ! Sometimes the file creation process goes well.

The difference is in the POST payload, the filePath is sometimes incorrect :

{
    "filePath": "/null/dguherz.md"
}

Tested on Chrome & Firefox (last versions) on Windows 10 et Mac OS X.

Regards,
GS.

Ok, so when accessing the folder directly from the homepage, It's ok !

But the error appears when accessing the folder via "Shared with others" or "Shared with me".

Same thin for accessing the folder via "Favorites".

GS.

@szaimen szaimen added 1. to develop Accepted and waiting to be taken care of feature: templates labels Sep 15, 2021
@skjnldsv
Copy link
Member

Hello everyone!
I found one bug in the template process, but I'm not sure that is also the issue here.
Can anyone that have a reproductible example screenshot the entire expanded stacktrace from the console?
e.g.:
image

@mvvvmd

This comment has been minimized.

@skjnldsv

This comment has been minimized.

@mvvvmd

This comment has been minimized.

@skjnldsv

This comment has been minimized.

@skjnldsv
Copy link
Member

skjnldsv commented Sep 17, 2021

Potential fix :#28871

Fixed by #28872

@skjnldsv skjnldsv linked a pull request Sep 17, 2021 that will close this issue
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 1. to develop Accepted and waiting to be taken care of labels Sep 17, 2021
@putt1ck
Copy link

putt1ck commented Nov 18, 2021

Noting issue has been closed but problem persists into NC 22.2.3 for new text docs; looks like some sort of initialisation issue, because a fix was accidentally discovered - as the instance also had drawio installed, a quick check found that creating new diagrams worked - and after creating a new diagram, creating a new text document also works.

The workaround seemed to be a permanent (so far!) fix for folders accessed via the files app "home" but it was noted it has to be reapplied for folders accessed through "shared with others" etc. - which lead to discovery that it has to be reapplied to folders that are shared (whether from, to or by link).

This is a live install that updates on the beta channel, initially built a while ago from source on then Ubuntu 16.04, now running on 20.04.

@putt1ck putt1ck reopened this Nov 18, 2021
@szaimen
Copy link
Contributor

szaimen commented Nov 18, 2021

Hi @putt1ck thanks for your feedback! Could you please open a new issue with your findings and post your server config and other needed info there? Thank you!

@szaimen szaimen closed this as completed Nov 18, 2021
@bitshiftnetau
Copy link

Still not fixed. This issue should not be closed.

@NiTRoeSE
Copy link

NiTRoeSE commented Feb 8, 2022

We have the same problem in combination with onlyoffice .. sometimes it works, most of the time it doenst.

{file=/var/www/nextcloud/apps/files/lib/Controller/TemplateController.php, line=57, function=createFromTemplate, class=OC\Files\Template\TemplateManager, type=->, args=[/null/vbv.md, , user]}, {file=/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php, line=217, function=create, class=OCA\Files\Controller\TemplateController, type=->, args=[/null/vbv.md, , user]}, {file=/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php, line=126, function=executeController, class=OC\AppFramework\Http\Dispatcher, type=->, args=[{__class__=OCA\Files\Controller\TemplateController}, create]}, {file=/var/www/nextcloud/lib/private/AppFramework/App.php, line=156, function=dispatch, class=OC\AppFramework\Http\Dispatcher, type=->, args=[{__class__=OCA\Files\Controller\TemplateController}, create]}, {file=/var/www/nextcloud/lib/private/Route/Router.php, line=302, function=main, class=OC\AppFramework\App, type=::, args=[OCA\Files\Controller\TemplateController, create, {__class__=OC\AppFramework\DependencyInjection\DIContainer}, {_route=ocs.files.Template.create}]}, {file=/var/www/nextcloud/ocs/v1.php, line=62, function=match, class=OC\Route\Router, type=->, args=[/ocsapp/apps/files/api/v1/templates/create]}, {file=/var/www/nextcloud/ocs/v2.php, line=23, args=[/var/www/nextcloud/ocs/v1.php], function=require_once}

NC: 22.2.3

Any help, workaround or fix would be awesome.
Thanks

@aptiko
Copy link

aptiko commented Feb 16, 2022

We still have this problem in a new 23.0.0 installation.

@zefzefzefzef
Copy link

had same issue. creating a template folder via the menu fixed it for me

@tj0xin
Copy link

tj0xin commented Mar 9, 2022

Having the same problem with Latest at the time of writing.

@baselab
Copy link

baselab commented Mar 28, 2022

Same issue here via "nextcloud:latest"
Fixed creating a new directory next to Templates and the other dirs (name is irrelevant and it can be removed afterwards)
Thanks zefzefzefzef

@zachrybaker
Copy link

Issue remains with latest. Should be reopened.
In my case in the console I see

typeError: OCA.Files.fileActions.getDefaultFileAction(...) is undefined
    e TemplatePicker.vue:222
    c runtime.js:63
    _invoke runtime.js:294
    g runtime.js:119
    $ main.js:358
    i main.js:358
    promise callback*$ main.js:358
    i main.js:358
    promise callback*$ main.js:358
    i main.js:358
    M main.js:358
    M main.js:358
    onSubmit TemplatePicker.vue:197
    submit TemplatePicker.vue:1

@biva
Copy link

biva commented Apr 3, 2022

Hello, we have the same issue (NC 23 + OnlyOffice 7.0.1) @szaimen , would it be possible to reopen this issue? Or to explain how to fix it? I'm sorry but I didn't understand the workarounds mentioned by @zefzefzefzef and @putt1ck : would anybody be able to give some more detail? Is there another open issue that we should follow?

Thanks for your support!

@drhirn
Copy link

drhirn commented May 5, 2022

Same.
Nextcloud Hub II 23.0.4

Console Output:

[ERROR] files: Error while creating the new file from template 
Object { app: "files", uid: "<uid>" }
ConsoleLogger.js:41:16
    log ConsoleLogger.js:41
    error ConsoleLogger.js:63
    e TemplatePicker.vue:233
    c runtime.js:63
    _invoke runtime.js:294
    g runtime.js:119
    $ main.js:358
    i main.js:358
    (Async: promise callback)
    $ main.js:358
    i main.js:358
    (Async: promise callback)
    $ main.js:358
    i main.js:358
    M main.js:358
    M main.js:358
    onSubmit TemplatePicker.vue:197
    r TemplatePicker.vue:170
    c runtime.js:63
    _invoke runtime.js:294
    g runtime.js:119
    $ main.js:358
    i main.js:358
    (Async: promise callback)
    $ main.js:358
    i main.js:358
    M main.js:358
    M main.js:358
    open TemplatePicker.vue:155
    actionHandler templates.js:113
    _promptFileName merged-index.js:11541
    jQuery 8
    _promptFileName merged-index.js:11518
    jQuery 10
    _promptFileName merged-index.js:11515
    _onClickAction merged-index.js:11446
    jQuery 2

and

TypeError: OCA.Files.fileActions.getDefaultFileAction(...) is undefined
    e TemplatePicker.vue:222
    c runtime.js:63
    _invoke runtime.js:294
    g runtime.js:119
    $ main.js:358
    i main.js:358
    promise callback*$ main.js:358
    i main.js:358
    promise callback*$ main.js:358
    i main.js:358
    M main.js:358
    M main.js:358
    onSubmit TemplatePicker.vue:197
    r TemplatePicker.vue:170
    c runtime.js:63
    _invoke runtime.js:294
    g runtime.js:119
    $ main.js:358
    i main.js:358
    promise callback*$ main.js:358
    i main.js:358
    M main.js:358
    M main.js:358
    open TemplatePicker.vue:155
    actionHandler templates.js:113
    _promptFileName merged-index.js:11541
    jQuery 8
    _promptFileName merged-index.js:11518
    jQuery 10
    _promptFileName merged-index.js:11515
    _onClickAction merged-index.js:11446
    jQuery 2
TemplatePicker.vue:234
    e TemplatePicker.vue:234
    c runtime.js:63
    _invoke runtime.js:294
    g runtime.js:119
    $ main.js:358
    i main.js:358
    (Async: promise callback)
    $ main.js:358
    i main.js:358
    (Async: promise callback)
    $ main.js:358
    i main.js:358
    M main.js:358
    M main.js:358
    onSubmit TemplatePicker.vue:197
    r TemplatePicker.vue:170
    c runtime.js:63
    _invoke runtime.js:294
    g runtime.js:119
    $ main.js:358
    i main.js:358
    (Async: promise callback)
    $ main.js:358
    i main.js:358
    M main.js:358
    M main.js:358
    open TemplatePicker.vue:155
    actionHandler templates.js:113
    _promptFileName merged-index.js:11541
    jQuery 8
    _promptFileName merged-index.js:11518
    jQuery 10
    _promptFileName merged-index.js:11515
    _onClickAction merged-index.js:11446
    jQuery 2

@lokedhs
Copy link

lokedhs commented Dec 9, 2022

Noting issue has been closed but problem persists into NC 22.2.3 for new text docs; looks like some sort of initialisation issue, because a fix was accidentally discovered - as the instance also had drawio installed, a quick check found that creating new diagrams worked - and after creating a new diagram, creating a new text document also works.

I saw this problem today after enabling full text search. Your workaround worked initially. However, after the indexation was run (I can tell because the content of the text file I created was found when I searched), the problem came back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.