nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.21k stars 3.95k forks source link

Accept custom filetype-Icons in integrity check #37079

Open ernolf opened 1 year ago

ernolf commented 1 year ago

Refering to this README file, I created a theme "myicons" containing this folder:

/var/www/nextcloud/themes/myicons/core/img/filetypes/

inside of that Folder I placed some own and aditional filetype icons and maped those Icons to the corresponding files, using the files config/mimetypemapping.json and config/mimetypealiases.json and the commands occ maintenance:mimetype:update-db (to add new defined mimetypes to database) and occ maintenance:mimetype:update-js (to recreate core/js/mimetypelist.js).

Works as a charm:

image

As far as I understand I have done everything as described and intended by the manuals and README file.

Unfortunately, the core/js/mimetypelist.js file modified in this way (by occ) does not pass the integrity check, which results in this anoying error:

image

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- core
    - INVALID_HASH
        - core/js/mimetypelist.js

Raw output
==========
Array
(
    [core] => Array
        (
            [INVALID_HASH] => Array
                (
                    [core/js/mimetypelist.js] => Array
                        (
                            [expected] => 4b0a99fbab7bc4824176101150bd0ab2b553e128a390e0f872580db4541462b31aad13099fd41533b6695d1b185dabca26a45e9a78227cfb9479eafa439c7bff
                            [current] => 978811dc32be4806ce330f28ddda27f569b83ffff856bc2c8a7d87b2669d6a0d3129f6c689ca7b6c913db559cc0d9a3e91e0e9299d8f396dc847b0b95d70cbe9
                        )

                )

        )

)

It would be a great improvement if themes would pass the Integrity Check, especially when they are implemented according to all the procedures provided and suggested.


How to use GitHub

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

ernolf commented 1 year ago

The integrity check fails, as soon as one create a folder:

/var/www/nextcloud/themes/$THEME/core/img/filetypes/

where it does not make a difference, if $THEME is activated in /config/config.php or if that folder contains files or not

Verry simple to reproduce (ncc is an alias to php -f /var/www/nextcloud/occ):

www-data@optiplex-380-1:~$ ncc integrity:check-core -v
No errors found
www-data@optiplex-380-1:~$ mkdir -p /var/www/nextcloud/themes/example/core/img/filetypes/
www-data@optiplex-380-1:~$ ncc integrity:check-core -v
  - INVALID_HASH:
    - core/js/mimetypelist.js:
      - expected: 4b0a99fbab7bc4824176101150bd0ab2b553e128a390e0f872580db4541462b31aad13099fd41533b6695d1b185dabca26a45e9a78227cfb9479eafa439c7bff
      - current: b3977aba190196491443fd0a9c45eca4aaeeefc61a3ab2217f559c8253f251e04292762261add76e7cf7b3c01d123b71c55dc3ad51da10fd251035b117a28680
1 errors found
www-data@optiplex-380-1:~$ rmdir /var/www/nextcloud/themes/example/core/img/filetypes
www-data@optiplex-380-1:~$ ncc integrity:check-core -v
No errors found

@szaimen : Could this be a bug or is it designed?

Root-Core commented 6 months ago

I have a similar problem. Some plugins seem to inject mimetypes into mimetypelist.js if occ maintenance:mimetype:update-js is run.

I'm pretty sure it is the Files 3D plugin from the store. (https://github.com/v1r0x/files_3d) It is not active though, so it shouldn't be allowed to do anything.

Also the draw.io plugin from the store - which is officially released for version 28 - adds some lines.

sudo -u www-data php occ integrity:check-core

  - INVALID_HASH:
    - core/js/mimetypelist.js:
      - expected: 550ab566d30693bfa24ec4b15d9df87731ae8a3be8f79dabf94757e5b8b20eec6e4b678f17af1718297f2872f6b04519eeb024d1dff11947f29da431c7f11201
      - current: 301654cbbe168b8723530db88fd2e40ad688f4e6b0bdaeade5b4fe34bd94d9d3cfe760821e97dc792e585d4b6ccff838597bfd46466bb07d30ff84df4cb79518
diff ~/mimetypelist.js core/js/mimetypelist.js 

15a16
>     "application/gzip": "package/x-generic",
83c84
<     "application/x-gzip": "package/x-generic",
---
>     "application/x-gzip": "application/gzip",
117c118,141
<     "image/x-emf": "image/emf"
---
>     "image/x-emf": "image/emf",
>     "model/3dm-nospec": "3dm",
>     "model/3ds-nospec": "3ds",
>     "model/3mf": "3mf",
>     "model/bim-nospec": "bim",
>     "model/brep-nospec": "brep",
>     "model/vnd.collada+xml": "dae",
>     "model/fbx-nospec": "fbx",
>     "model/fcstd-nospec": "fcstd",
>     "model/gltf-binary": "glb",
>     "model/gltf+json": "gltf",
>     "application/x-step": "ifc",
>     "model/iges": "iges",
>     "model/obj": "obj",
>     "model/off-nospec": "off",
>     "model/ply-nospec": "ply",
>     "model/vnd.ply": "ply",
>     "model/step": "step",
>     "model/stl": "stl",
>     "application/sla": "stl",
>     "model/vrml": "wrl",
>     "model/mtl": "mtl",
>     "application/x-drawio": "drawio",
>     "application/x-drawio-wb": "dwb"
122a147,148
>     "drawio",
>     "dwb",
cp ~/mimetypelist.js core/js/mimetypelist.js

# diff is empty

sudo -u www-data php occ integrity:check-core
No errors found

sudo -u www-data php occ maintenance:mimetype:update-js
mimetypelist.js is updated

# diff is like above

sudo -u www-data php occ integrity:check-core

  - INVALID_HASH:
    - core/js/mimetypelist.js:
      - expected: 550ab566d30693bfa24ec4b15d9df87731ae8a3be8f79dabf94757e5b8b20eec6e4b678f17af1718297f2872f6b04519eeb024d1dff11947f29da431c7f11201
      - current: 301654cbbe168b8723530db88fd2e40ad688f4e6b0bdaeade5b4fe34bd94d9d3cfe760821e97dc792e585d4b6ccff838597bfd46466bb07d30ff84df4cb79518