dak180 / FreeNAS-Report

SMART & ZPool Status Report for FreeNAS/TrueNAS
GNU General Public License v3.0
38 stars 8 forks source link

Config file attachment "noname" instead of file name #14

Closed smaniktahla closed 1 year ago

smaniktahla commented 2 years ago

When executing the script and emailing to personal gmail account, I get a file attachment called "noname" that appears to have the MIME payload when I edit it.

The file attachment's first two lines are: Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=20220624230508_TrueNAS-12.0-U8.1-4e9efc861d.tar.gz (and then the MIME payload)

Everything else seems fine, the email appears with all other relevant script info properly formatted, and the backup file exists in the backup location with the correct name. I don't know enough about MIME headers to know what might be the issue here, though.

Any assistance would be greatly appreciated!

SMARTScriptFileAttachmentMIME image
dak180 commented 2 years ago

@smaniktahla what are your settings in the ### TrueNAS config backup settings section of your config file?

smaniktahla commented 2 years ago

Here's what I have in the .conf file. The file does appear in /root/backup, which is what's really weird to me. image

TrueNAS config backup settings

configBackup="true" # Change to "false" to skip config backup (which renders next two options meaningless); "true" to keep config backups enabled emailBackup="true" # Change to "true" to email TrueNAS config backup saveBackup="true" # Change to "false" to delete TrueNAS config backup after mail is sent; "true" to keep it in dir below backupLocation="/root/backup" # Directory in which to save TrueNAS config backups

dak180 commented 2 years ago

@smaniktahla try this branch and let me know if it helps.

smaniktahla commented 2 years ago

Sorry for the long delay in replying, but nope, same thing with the new branch:

image

karearea83 commented 1 year ago

I corrected this by editing report.sh at line 170 from: echo -e "Content-Type: application/tar+gzip\n" to echo -e "Content-Type: application/tar+gzip"\n

I did the same to lines 151, 179 and 1667 as they seem to suffer from the same issue.

I do not know if this is the correct way to fix it, but it's now working for me.

dak180 commented 1 year ago

@karearea83 do echo -e 'Content-Type: application/tar+gzip\n' or echo "Content-Type: application/tar+gzip" also work?

smaniktahla commented 1 year ago

That line looked like this in my version of the script (which @dak180 had steered me to previously): echo -e "Content-Type: application/tar+gzip name='"'${filename}.tar.gz'"'\n"

What does the \n do?

dak180 commented 1 year ago

@smaniktahla It adds a new line.

smaniktahla commented 1 year ago

Ah okay. Well, putting the \n outside the double quotes didn't change things for me. I did try this with the lines referenced by @karearea83, but no luck. I can mangle the script so it produces worse output, too 😁 as I found out to my consternation.

karearea83 commented 1 year ago

@karearea83 do echo -e 'Content-Type: application/tar+gzip\n' or echo "Content-Type: application/tar+gzip" also work?

The first does not, it goes back to a noname file. The second is what the original script I had has and does work.

With echo -e "Content-Type: text/html; charset=utf-8"\n I expect to output to be "Content-Type: text/html; charset=utf-8"

And with echo -e "Content-Type: text/html; charset=utf-8\n" I expect the output to be "Content-Type: text/html; charset=utf-8 "

I believe the former is the correct syntax.

I'm running TrueNAS-13.0-U2.

dak180 commented 1 year ago

@smaniktahla or @karearea83 try this branch and let me know if it helps.

karearea83 commented 1 year ago

Hi @dak180

Nope, that one doesn't work. But I do get a different outcome this time.

It's now calling the file "'${filename}.tar.gz'", screen grab attached

image

dak180 commented 1 year ago

@karearea83 i just pushed another commit (same link); let me know if that fixes it entirely.