How to omit full file path for source files in Transfer Notifications

By default the email templates provided for transfer notifications include the full path of the source files being transferred. In some cases it may be desirable to include only the file name and not the full path of the source files, such as when you do not want to expose a user's full document root path.

If you prefer to hide the full source path of files in your transfer notifications, you can either edit a mail template yourself, or download the edited template at the end of this article and install it into your system. Below are instructions for both methods:

First Method: (Add/Edit your own mail template)

You can create a template based on the AllFiles template, then edit the section to change what path is displayed to the recipient.

1)  Go to Tools > Mail Templates.

toolsmail.png

2)  Click the plus arrow to add a new template, name it accordingly, and base it on AllFiles.

3)  Click the pencil icon to edit this template.

AllFiles_no_path_.png

4)  Edit the HTML output of the mail template.

Locate the section within the HTML box that shows:

#foreach ($path in $event.getSourcePaths())
     <br>$formatter.decodePath($path)
#end

and replace it with:

#foreach ($path in $event.getSourcePaths())
#set ($fileNameIndex = $path.lastIndexOf('/') + 1)
#if ($fileNameIndex == 0)
#set ($fileNameIndex = $path.lastIndexOf('\') + 1)
#end
<br> $formatter.decodePath($path.substring($fileNameIndex))
#end

Next, locate the following section in the HTML box:

#foreach ($file in $event.getFiles())
$formatter.decodePath($file)<br>
#end

and replace it with:

#foreach ($file in $event.getFiles())
#set ($fileNameIndex = $file.lastIndexOf('/') + 1)
#if ($fileNameIndex == 0)
#set ($fileNameIndex = $file.lastIndexOf('\') + 1)
#end
$formatter.decodePath($file.substring($fileNameIndex))<br>
#end

What you are doing is setting the displayed source file to be whatever comes after the last slash in the file path, which corresponds to just the file name.

5)  Edit the text output of the mail template.

Locate the section within the Text box that shows:

 #foreach ($path in $event.getSourcePaths())
    $formatter.decodePath($path)
#end

and replace it with:

#foreach ($path in $event.getSourcePaths())
#set ($fileNameIndex = $path.lastIndexOf('/') + 1)
#if ($fileNameIndex == 0)
#set ($fileNameIndex = $path.lastIndexOf('\') + 1)
#end
$formatter.decodePath($path.substring($fileNameIndex))
#end

Finally, locate the following section in the Text box:

Files:
#foreach ($file in $event.getFiles())
$formatter.decodePath($file)
#end

and replace it with:

Files:
#foreach ($file in $event.getFiles())
#set ($fileNameIndex = $file.lastIndexOf('/') + 1)
#if ($fileNameIndex == 0)
#set ($fileNameIndex = $file.lastIndexOf('\') + 1)
#end
$formatter.decodePath($file.substring($fileNameIndex))
#end

The final view should look something like this:

AllFiles_no_path_.png

 Click OK to complete.

Second Method: (Download and install our custom mail template)

1)  Download the zip file attached to this article, AllFiles (No Path).zip

2)  Extract the file to the MailTemplates folder within your Aspera product's etc folder, which may be found in the following locations depending on your system (replace "Product Name" with your installed product, such as "Enterprise Server"; replace "User" with the user account that installed the product):

  • Windows (all users install): C:\Program Files (x86)\Aspera\(Product Name)\etc\MailTemplates
  • Windows (7/2008/Vista single user install): C:\Users\(User)\AppData\Local\Programs\Aspera\(Product Name)\etc\MailTemplates
  • Windows (2003/XP single user install): C:\Documents and Settings\(User)\Application Data\Aspera\(Product Name)\etc\MailTemplates
  • Mac (all users install): /Library/Aspera/etc/MailTemplates
  • Mac (single user install): /Users/(User)/Library/Application Support/Aspera/(Product Name)/MailTemplates
  • Linux: /opt/aspera/etc/MailTemplates

3)  Once the AllFiles (No Path) folder is within the MailTemplates folder, you can select this template from the GUI (you may need to restart the GUI to see the new template).

Attachments

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk