2011-11-06, 12:12
Hi,
I'm implementing downloads thru JSON RPC and I face an issue regarding how to get the actual filename (without the path) of a file I download.
In the items details, we have "file", which is a server path, really, not easily usable on a remote client because it could be anything, depending on the source.
Then, with Files.PrepareDownload, we receive another path which is transport dependent, and not manipulable by a client because it could be anything, really.
My suggestion would be to return the filename (without the path) in the details returned from Files.PrepareDownload, together with "path".
I assume:
1) it would be easier for the server to extract a source independent filename than for a client.
2) every client using download would need a filename, so it seems logic to try to avoid that every client must implement complex regexp to extract the filename from the "file" field.
I'm implementing downloads thru JSON RPC and I face an issue regarding how to get the actual filename (without the path) of a file I download.
In the items details, we have "file", which is a server path, really, not easily usable on a remote client because it could be anything, depending on the source.
Then, with Files.PrepareDownload, we receive another path which is transport dependent, and not manipulable by a client because it could be anything, really.
My suggestion would be to return the filename (without the path) in the details returned from Files.PrepareDownload, together with "path".
I assume:
1) it would be easier for the server to extract a source independent filename than for a client.
2) every client using download would need a filename, so it seems logic to try to avoid that every client must implement complex regexp to extract the filename from the "file" field.