fix: allow occ maintenance:update:htaccess to create .htaccess file in case it doesn't exist yet#57227
fix: allow occ maintenance:update:htaccess to create .htaccess file in case it doesn't exist yet#57227lpcvoid wants to merge 2 commits intonextcloud:masterfrom
occ maintenance:update:htaccess to create .htaccess file in case it doesn't exist yet#57227Conversation
szaimen
left a comment
There was a problem hiding this comment.
I am not sure about this. The file needs to exist beforehand otherwise it might misses the important default config: https://github.com/nextcloud/server/blob/master/.htaccess
|
I had a situation where I copied over a directory using I am not aware of many of the potential side issues this may cause, but when I tested this locally, it fixed my problem. I also think it's better to have a It's up to you to do with this what you think is best, of course. |
In my opinion the command should fail if the file does not exist but maybe we could improve the error message? |
|
That's probably a good idea in any case, yeah :) Shall I remove the commit which adds the creation, and keep the single commit which changes the error message? |
Sounds good to me, yes :) |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
|
@lpcvoid you need to run |
Currently, the updateHtaccess() function can't deal with a missing .htaccess file, it assumes at least an empty .htaccess file. In some cases, the file may be missing though, and this commit adds functionality for creating it when this edgecase occurs. Signed-off-by: Marc <mail@lpcvoid.com>
This adds a hint to the error message that file creation may also have failed. Signed-off-by: Marc <mail@lpcvoid.com>
|
Hey @provokateurin - sorry for my late response. I have manually edited my commit to fix the linter errors, they should pass now. I have squashed the fix commit and force pushed. |
provokateurin
left a comment
There was a problem hiding this comment.
TBH I'd rather see the instance not allowing any interaction if the file is missing, because it means that your setup is borked and other things could be broken as well.
|
That's what happened in my case anyhow (I wasn't able to access NC). It was fixable though by re-wrtiting the htaccess file via At the very least I'd love to simply change the error message as indicated in the second commit, since that would have saved me a whole lot of debugging :) |
Currently, the
updateHtaccess()function can't deal with a missing .htaccess file, it assumes at least an empty .htaccess file.In some cases, the file may be missing though, and this PR adds functionality for creating it when this edgecase occurs.
Before this PR, executing
occ maintenance:update:htaccesscan fail without the error message being explicit about this edgecase.occ maintenance:update:htaccessnot working.Summary
occ maintenance:update:htaccesscan now also create .htaccess files, instead of relying on them being present.TODO
Checklist
3. to review, feature component)stable32)