SimpleMachines / SMF

Simple Machines Forum — SMF in short — is free and open-source community forum software, delivering professional grade features in a package that allows you to set up your own online community within minutes!
https://www.simplemachines.org/
Other
582 stars 251 forks source link

Uploading non-packages shows misleading error messages #7379

Open m4z opened 2 years ago

m4z commented 2 years ago

Description

I've seen several users trying to upload, for example, the install tarball, and I wondered myself if I could upload language packs via this route.

Steps to reproduce

  1. Try to upload a language file (smf_2-1-rc3_german_informal.tar.gz) via Package Manager → The error will suggest that the file might have been empty, or the permissions are incorrect, but it doesn't say "that wasn't a package I can work with":
    An error has occurred
    Package upload failed due to the following error:
    "Although the package was downloaded to the server it appears to be empty. Please check the Packages directory and the "temp" sub-directory are both writable. If you continue to experience this problem you should try extracting the package on your PC and uploading the extracted files into a subdirectory in your Packages directory and try again. For example, if the package was called shout.tar.gz you should:
    1) Download the package to your local PC and extract it into files.
    2) Using an FTP client create a new directory in your "Packages" folder, in this example you may call it "shout".
    3) Upload all the files from the extracted package to this directory.
    4) Go back to the package manager browse page and the package will be automatically found by SMF."
  2. Try to upload smf_2-1-1_{install,upgrade}.zip: Same as above.
  3. Try to upload smf_2-0-15_install.zip:
    An error has occurred
    Package upload failed due to the following error:
    "You cannot install a Theme from this section, please use the [Themes and Layout](https://my.forum.example/index.php?action=admin;area=theme;sa=admin;[hexstring]#theme_install) management page to upload it"

Environment (complete as necessary)

jdarwood007 commented 2 years ago

Its a non package manager file is all. Its looking for package-info.xml

Funny enough. We could easily slap a package-info.xml that would say copy all the language files to the languages folder and bam, the language is installed.

m4z commented 2 years ago

Thanks for the info, that could indeed be useful.

My main point though was that the error could be less misleading and much more helpful. I don't know much about the package format and less about the related code, but with what you wrote it seems to be easy to detect if a package is invalid (package-info.xml missing in the archive) and display that to the user instead of "something vague or other might have happened".

m4z commented 2 years ago

I have updated my initial post. It seems the error is consistent for the most part, but I still find it misleading.