mike-jumper commented on code in PR #367:
URL: https://github.com/apache/guacamole-server/pull/367#discussion_r959788237


##########
src/common-ssh/sftp.c:
##########
@@ -653,10 +654,19 @@ static int guac_common_ssh_sftp_ls_ack_handler(guac_user* 
user,
 
         /* Determine mimetype */
         const char* mimetype;
-        if (LIBSSH2_SFTP_S_ISDIR(attributes.permissions))
-            mimetype = GUAC_USER_STREAM_INDEX_MIMETYPE;
-        else
-            mimetype = "application/octet-stream";
+        //adding file size and permission
+        char tmpstr[150];
+       if (LIBSSH2_SFTP_S_ISDIR(attributes.permissions)) {
+               sprintf(tmpstr, "{\"mime\":\"%s\",\"size\":%llu,\"perm\":%lu}",
+                       GUAC_USER_STREAM_INDEX_MIMETYPE, attributes.filesize,
+                       attributes.permissions);
+       }
+       else {
+               sprintf(tmpstr, "{\"mime\":\"%s\",\"size\":%llu,\"perm\":%lu}",
+                       "application/octet-stream", attributes.filesize,
+                       attributes.permissions);
+       }
+       mimetype = tmpstr;

Review Comment:
   +1
   
   This would also break compatibility with any implementation that expects the 
value to be a mimetype string, which is also what we have defined for the 
protocol: 
https://guacamole.apache.org/doc/gug/protocol-reference.html#get-instruction
   
   I think a better approach would be to leverage mimetype parameters to encode 
the information in a compatible way within the mimetype itself. This would 
allow the same information to be encoded for other instructions like `file`, as 
well. For example:
   
   ```
   application/octet-stream;size=12345;mode=0644;uid=123;gid=456
   ```
   
   If there are standard parameters for this, we can use them, or failing that 
we can define our own.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to