{"action":"created","issue":{"url":"https://api.github.com/repos/RH-FMK/sktm/issues/77","repository_url":"https://api.github.com/repos/RH-FMK/sktm","labels_url":"https://api.github.com/repos/RH-FMK/sktm/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/RH-FMK/sktm/issues/77/comments","events_url":"https://api.github.com/repos/RH-FMK/sktm/issues/77/events","html_url":"https://github.com/RH-FMK/sktm/issues/77","id":329804304,"node_id":"MDU6SXNzdWUzMjk4MDQzMDQ=","number":77,"title":"Use path manipulations instead of string concatenations","user":{"login":"veruu","id":8031381,"node_id":"MDQ6VXNlcjgwMzEzODE=","avatar_url":"https://avatars1.githubusercontent.com/u/8031381?v=4","gravatar_id":"","url":"https://api.github.com/users/veruu","html_url":"https://github.com/veruu","followers_url":"https://api.github.com/users/veruu/followers","following_url":"https://api.github.com/users/veruu/following{/other_user}","gists_url":"https://api.github.com/users/veruu/gists{/gist_id}","starred_url":"https://api.github.com/users/veruu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veruu/subscriptions","organizations_url":"https://api.github.com/users/veruu/orgs","repos_url":"https://api.github.com/users/veruu/repos","events_url":"https://api.github.com/users/veruu/events{/privacy}","received_events_url":"https://api.github.com/users/veruu/received_events","type":"User","site_admin":false},"labels":[{"id":857756531,"node_id":"MDU6TGFiZWw4NTc3NTY1MzE=","url":"https://api.github.com/repos/RH-FMK/sktm/labels/enhancement","name":"enhancement","color":"a2eeef","default":true},{"id":857756534,"node_id":"MDU6TGFiZWw4NTc3NTY1MzQ=","url":"https://api.github.com/repos/RH-FMK/sktm/labels/good%20first%20issue","name":"good first issue","color":"7057ff","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-06-06T10:13:20Z","updated_at":"2018-06-08T14:17:24Z","closed_at":null,"author_association":"MEMBER","body":"Both URL and file path joins use slashes as dividers between their parts. When joining them, we need to be extra careful if the original path ends with slash or there is none. Examples:\r\n\r\n`path/to/dir + file --> path/to/dir/file`\r\n`path/to/dir/ + file --> path/to/dir/file`\r\n`http://url.com/ + part --> http://url.com/part`\r\n`http://url.com + part --> http://url.com/part`\r\n\r\nRight now, most of the code uses string concatenation for joins, which doesn't handle any of these cases. This requires us to be extra careful about what is passed to the functions (eg. some websites don't like double slashes), which is not that simple with all the passing between different functions and objects and doesn't check user inputs either.\r\n\r\n`os.path.join()` can deal with all these cases and works just fine with both URLs and filepaths. This allows us to simply type `os.path.join('http://url.com', 'part')` or `os.path.join(directory, filename)` (if variables are used) and not care about ending slashes anywhere."},"comment":{"url":"https://api.github.com/repos/RH-FMK/sktm/issues/comments/395774987","html_url":"https://github.com/RH-FMK/sktm/issues/77#issuecomment-395774987","issue_url":"https://api.github.com/repos/RH-FMK/sktm/issues/77","id":395774987,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTc3NDk4Nw==","user":{"login":"danghai","id":10912671,"node_id":"MDQ6VXNlcjEwOTEyNjcx","avatar_url":"https://avatars1.githubusercontent.com/u/10912671?v=4","gravatar_id":"","url":"https://api.github.com/users/danghai","html_url":"https://github.com/danghai","followers_url":"https://api.github.com/users/danghai/followers","following_url":"https://api.github.com/users/danghai/following{/other_user}","gists_url":"https://api.github.com/users/danghai/gists{/gist_id}","starred_url":"https://api.github.com/users/danghai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danghai/subscriptions","organizations_url":"https://api.github.com/users/danghai/orgs","repos_url":"https://api.github.com/users/danghai/repos","events_url":"https://api.github.com/users/danghai/events{/privacy}","received_events_url":"https://api.github.com/users/danghai/received_events","type":"User","site_admin":false},"created_at":"2018-06-08T14:17:24Z","updated_at":"2018-06-08T14:17:24Z","author_association":"CONTRIBUTOR","body":"@veruu . If I change `full_url = \"{}/{}\".format(url, patch)` the case:\r\n`mbox_url = os.path.join(url, 'mbox')` --> `full_join_path(url, 'mbox')\r\n`fpath = '/'.join([self.wdir, fname])`  --> `full_join_path(self.wdir, fname)`. \r\n\r\n> so the part with creating a specific URL of a patch (and variable naming) needs to be changed.\r\nCould you suggest the good variable name and the function name too? I do not see any issue in creating specific URL and the patch. Could you elaborate more by example?\r\n"}}
{"actor":{"display_login":"danghai"}}