fix(exportfile): Correctly handle empty index arg (refs #4442)

An incorrect test on the $index variable would prevent exporting a
single file from a file attribute.
Merge pull request #1091 from eguaj/3.2-A4442

fix(exportfile): Correctly handle empty index arg (closes #4442)