SVG upload upsets template setting

So this is a bit odd. When I upload an SVG (Made with Sketch), the upload doesn’t happen and the page template gets changed to the default template but the actual text file for the page does not get renamed. If i manually upload the SVG files with FTP, they show up in the panel and i can work on them from there.

It’s not happy about uploading them or replacing existing ones. Other images like PNG and Jpeg work fine.

Its Kirby 2.5.12 running on Fortrabbit. It seems to work ok locally on a mac running Valet+. Any ideas?

Hm, sounds like it doesn’t recognize the mime type. Do you get any error messages in the log files or console? Could you send me the file for testing if it works in my environment?

Yes it think its something like that but every seems set. I will DM the file to you, and check the logs.

Uploaded without any issues in my local MAMP setup. So no idea where to start debugging this.

Would be interesting if a standard PHP upload would upload this file on Fortrabbit.

Annoyingly, the logs are empty so Im just as stumped as you.

Could you test a simple - non-Kirby - file upload with that file?

Weirder and weirder… plain PHP up load worked just fine (I used this).

Just noticed something else too - delete the files through the panel works, but it does not also delete the meta files for the images. If i upload the files through the panel, it creates the meta data files but the image itself is not uploaded. Kirby gives me the green smily face so all is well as far as its concerned - except it isnt :frowning:

That’s then the reason why the template changes…

I haven’t actually seen it do that, only after it happened. Some one else made it happen several times in a row and the only way i could fix it was to re-upload my local copy. Kirby refused to change the template back to the correct one each time and i noticed that the page title had been changed to lower case as well.

I just made it do it. It happens when the SVG filename contains the same name as the page. In this case, my page is called Sponsors and the filename is ‘sponsorsdesktop.svg’. That seems to trip out the panel, in addition to the not uploading the file.

So if you rename the file, it uploads? Or it still doesn’t upload but the template change doesn’t happen?

To be clear, there are two things going on here:

  1. Ive tried several SVG files and none of them upload through the panel, but Kirby does give me a smily face and create the meta files that belong to the file, despite the file itself not getting written to the content folder.

  2. If the SVG filename contains the same name as the page, theres an additional error as well as the file not getting written. In this case, my page is called Sponsors and the filename is ‘sponsorsdesktop.svg’. That seems to freak out the panel, the only fix is to trash the content folder via FTP and re-upload it. If i rename that same file to something else like ‘spdesktop.svg’ then that just gives me the first error but the template change doesnt happen.

Its running PHP 7.1

Does the same thing happen with other .svg files as well, i.e. not created with Sketch?

Anyway, I have no way to dive into this, so could you please create an issue in the K2 repo?

It’s potentially looking like something Sketch is doing when it exports the file. If i open the SVG in Affinity Designer and save it out again, it uploads fine. Therefore, i’m guessing there is something in the way that Sketch is structuring the SVG file.

Should I still make a ticket?

It’s up to you. But would you mind checking if the same happens with K3 and this file in this environment?

Sure, ill try it out as soon as I have time.

1 Like