{"action":"closed","issue":{"url":"https://api.github.com/repos/hydroshare/hydroshare/issues/2105","repository_url":"https://api.github.com/repos/hydroshare/hydroshare","labels_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/2105/labels{/name}","comments_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/2105/comments","events_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/2105/events","html_url":"https://github.com/hydroshare/hydroshare/issues/2105","id":226887631,"number":2105,"title":"Drastic differences between file/folder assumptions in iRODs (REST) code and in JavaScript code","user":{"login":"alvacouch","id":3342292,"avatar_url":"https://avatars2.githubusercontent.com/u/3342292?v=3","gravatar_id":"","url":"https://api.github.com/users/alvacouch","html_url":"https://github.com/alvacouch","followers_url":"https://api.github.com/users/alvacouch/followers","following_url":"https://api.github.com/users/alvacouch/following{/other_user}","gists_url":"https://api.github.com/users/alvacouch/gists{/gist_id}","starred_url":"https://api.github.com/users/alvacouch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alvacouch/subscriptions","organizations_url":"https://api.github.com/users/alvacouch/orgs","repos_url":"https://api.github.com/users/alvacouch/repos","events_url":"https://api.github.com/users/alvacouch/events{/privacy}","received_events_url":"https://api.github.com/users/alvacouch/received_events","type":"User","site_admin":false},"labels":[{"id":208375129,"url":"https://api.github.com/repos/hydroshare/hydroshare/labels/Close%20Me!","name":"Close Me!","color":"5319e7","default":false},{"id":275707500,"url":"https://api.github.com/repos/hydroshare/hydroshare/labels/in%20progress","name":"in progress","color":"ededed","default":false},{"id":233668032,"url":"https://api.github.com/repos/hydroshare/hydroshare/labels/REST%20API","name":"REST API","color":"fef2c0","default":false},{"id":603769517,"url":"https://api.github.com/repos/hydroshare/hydroshare/labels/User%20Interface","name":"User Interface","color":"f28500","default":false}],"state":"closed","locked":false,"assignee":{"login":"alvacouch","id":3342292,"avatar_url":"https://avatars2.githubusercontent.com/u/3342292?v=3","gravatar_id":"","url":"https://api.github.com/users/alvacouch","html_url":"https://github.com/alvacouch","followers_url":"https://api.github.com/users/alvacouch/followers","following_url":"https://api.github.com/users/alvacouch/following{/other_user}","gists_url":"https://api.github.com/users/alvacouch/gists{/gist_id}","starred_url":"https://api.github.com/users/alvacouch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alvacouch/subscriptions","organizations_url":"https://api.github.com/users/alvacouch/orgs","repos_url":"https://api.github.com/users/alvacouch/repos","events_url":"https://api.github.com/users/alvacouch/events{/privacy}","received_events_url":"https://api.github.com/users/alvacouch/received_events","type":"User","site_admin":false},"assignees":[{"login":"alvacouch","id":3342292,"avatar_url":"https://avatars2.githubusercontent.com/u/3342292?v=3","gravatar_id":"","url":"https://api.github.com/users/alvacouch","html_url":"https://github.com/alvacouch","followers_url":"https://api.github.com/users/alvacouch/followers","following_url":"https://api.github.com/users/alvacouch/following{/other_user}","gists_url":"https://api.github.com/users/alvacouch/gists{/gist_id}","starred_url":"https://api.github.com/users/alvacouch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alvacouch/subscriptions","organizations_url":"https://api.github.com/users/alvacouch/orgs","repos_url":"https://api.github.com/users/alvacouch/repos","events_url":"https://api.github.com/users/alvacouch/events{/privacy}","received_events_url":"https://api.github.com/users/alvacouch/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/hydroshare/hydroshare/milestones/37","html_url":"https://github.com/hydroshare/hydroshare/milestone/37","labels_url":"https://api.github.com/repos/hydroshare/hydroshare/milestones/37/labels","id":2117667,"number":37,"title":"Release 1.10.0","description":"iRODS 4.2.2.  File handling improvements.","creator":{"login":"dtarb","id":3456833,"avatar_url":"https://avatars2.githubusercontent.com/u/3456833?v=3","gravatar_id":"","url":"https://api.github.com/users/dtarb","html_url":"https://github.com/dtarb","followers_url":"https://api.github.com/users/dtarb/followers","following_url":"https://api.github.com/users/dtarb/following{/other_user}","gists_url":"https://api.github.com/users/dtarb/gists{/gist_id}","starred_url":"https://api.github.com/users/dtarb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtarb/subscriptions","organizations_url":"https://api.github.com/users/dtarb/orgs","repos_url":"https://api.github.com/users/dtarb/repos","events_url":"https://api.github.com/users/dtarb/events{/privacy}","received_events_url":"https://api.github.com/users/dtarb/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":87,"state":"open","created_at":"2016-11-07T00:51:01Z","updated_at":"2017-05-22T15:32:25Z","due_on":"2017-04-19T07:00:00Z","closed_at":null},"comments":5,"created_at":"2017-05-07T19:40:14Z","updated_at":"2017-05-22T15:32:25Z","closed_at":"2017-05-22T15:32:24Z","body":"@pkdash @hyi @dtarb I am looking for possible causes of file corruption as addressed in PR #2090 .\r\n\r\nThe code [here](https://github.com/hydroshare/hydroshare/blob/develop/hs_core/views/utils.py#L778) doesn't match the comment: \r\n```    \r\n    # if we are moving to a directory, put the filename into the request.\r\n    if src_file_dir != tgt_file_dir and tgt_file_name != src_file_name:\r\n        tgt_full_path = os.path.join(tgt_full_path, src_file_name)\r\n```\r\nThere is no way it could match the comment, because \r\n\r\n1. The target need not exist (and is created automatically if not), so \r\n2. There is no way to check whether it is a directory (because it might not exist). \r\n\r\nThe way it is written, \r\n1. The only way you can change a file name if is it is in the same directory as before. \r\n2. If you move a file to a new directory, it assumes that the whole `tgt_full_path` is that directory even if the intent is to change the file name at the same time. \r\n\r\nIt strikes me that naïve use of this routine could have very unexpected results. This might be at the root of @ChristinaB's problems as routed out by @Castronova . E.g., if one calls\r\n```\r\nmove_or_rename_file_or_folder(user, resource_id, 'data/contents/foo/cat.txt', 'data/contents/bar/dog.txt')\r\n```\r\nthen the result will be `data/contents/bar/dog.txt/cat.txt`. `dog.txt` is interpreted as a directory (whether it is or not). \r\n"}}
{"actor":{"display_login":"dtarb"}}