Asiri Rathnayake wrote:
Hi,
1) Upload the file as an attachment just as before.
2) Make a second rpc call. This RPC call will import the latest attachment to the current page by the current user. This way we don't need to worry about crappy file names and browser specific stuff.
I Implemented this approach and it works fine and fixes both the issues http://jira.xwiki.org/jira/browse/XWIKI-3288 and http://jira.xwiki.org/jira/browse/XAOFFICE-10
Still I'm wondering if this is the correct approach or not. I won't commit the code for the moment, in the mean time if you have any comments please let me know.
This solution, while working in most of the cases, is not interleaving-free. Between the moment of the upload and the moment of the RPC call (when you get last attachment), another attachment might have been uploaded and so you get a wrong and very strange result for the user. Even if it works in most of the cases, I think we should look for another solution that would really give back the name of the attachment, since we might need it in many other places. I'm not at all knowledgeable of the REST API, but if it were a method there to attach a file and send back attached file name in JSON (or something), it would be so great. Happy coding, Anca
Thanks.
- Asiri _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs