When a file is uploaded from the Dashboard for a Class with a File column, the saved filename is different to what Parse.com produces and consequently the client applications such as the Dashboard displays a truncated version of the filename.
Result is:
{
"results": [
{
"LicenseFile": {
"__type": "File",
"name": "fcb209ccfab5b87912c61cd32b2ac47f_LICENSE.txt",
"url": "http://localhost:1337/parse/files/00000/fcb209ccfab5b87912c61cd32b2ac47f_LICENSE.txt"
},
"createdAt": "2016-07-27T23:46:07.763Z",
"objectId": "9BDB1sc6gj",
"updatedAt": "2016-07-27T23:46:07.763Z"
}
]
}
Note the filename: fcb209ccfab5b87912c61cd32b2ac47f_LICENSE.txt
Result is:
{
"results": [
{
"LicenseFile": {
"__type": "File",
"name": "tfss-59be62cc-7cc0-4aec-9618-ecb2df31f734-LICENSE.txt",
"url": "http://files.parsetfss.com/6eb5be43-2dfb-4dd7-8297-358c52aa8260/tfss-59be62cc-7cc0-4aec-9618-ecb2df31f734-LICENSE.txt"
},
"createdAt": "2016-07-19T02:01:31.133Z",
"objectId": "oAwS5kjYZe",
"updatedAt": "2016-07-27T01:40:03.467Z"
}
]
}
Note the filename: tfss-59be62cc-7cc0-4aec-9618-ecb2df31f734-LICENSE.txt
As you can see, the random string prefix in the Parse.com version has got the dashes.
When the Dashboard reads the name value, it uses an offset (i.e. 37 or 42 depending on whether the filename starts with tfss- or not) to extract the original uploaded filename. Because of the missing dashes, this results in a truncated filename for display.
The display issue can be easily fixed in the Dashboard, but it is best fixed in the Server as other clients such as Mobile apps using the SDKs are probably experiencing the same issue.
filename: LICENSE.txt
filename: NSE.txt
You can turn on additional logging by configuring VERBOSE=1 in your environment.
Not applicable
One fix would be to save the files with dashes in the filename. I have tested this and seems to work. Happy to send a PR for review.
a possible alternate fix might be to provide a user configurable option to include/exclude the '-' dashes that make the code look like a uuid.
folks, this is a bigger issue than just a truncated name in the dashboard.
any app relying on the file format to retrieve the filename (and I bet there are many) will be impacted by this.
can we get some consensus on a direction forward please?
The issue raised here seems quite clear and I'm inclined to agree it should be fixed in Parse Server. Can you submit a PR?
Closing as released part of 2.2.20
Most helpful comment
folks, this is a bigger issue than just a truncated name in the dashboard.
any app relying on the file format to retrieve the filename (and I bet there are many) will be impacted by this.
can we get some consensus on a direction forward please?