{"action":"created","comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/79134336","id":79134336,"diff_hunk":"@@ -50,21 +50,62 @@ public static function stripExt($file)\n \t * Makes file name safe to use\n \t *\n \t * @param   string  $file  The name of the file [not full path]\n+\t * @param   string  $language  (optional) The language to use of the transliterating the file name\n \t *\n \t * @return  string  The sanitised string\n \t *\n \t * @since   11.1\n \t */\n-\tpublic static function makeSafe($file)\n+\tpublic static function makeSafe($file, $language = null)\n \t{\n-\t\t// Remove any trailing dots, as those aren't ever valid file names.\n+\t\t// Replace spaces with dash after removing any leading / trailing spaces\n+\t\t$file = str_replace(\" \", \"-\", trim($file));\n+\n+\t\t// Remove any trailing dots, as those aren't ever valid file names\n \t\t$file = rtrim($file, '.');\n \n+\t\t// Regex for replacing non safe characters\n \t\t$regex = array('#(\\.){2,}#', '#[^A-Za-z0-9\\.\\_\\- ]#', '#^\\.#');\n \n-\t\treturn trim(preg_replace($regex, '', $file));\n+\t\t// Language transliteration should include given language, and also site + admin defaults (most useful is site default)\n+\t\t$lang_params = JComponentHelper::getParams('com_languages');","path":"libraries/joomla/filesystem/file.php","position":25,"original_position":25,"commit_id":"6ed8e94c8bbd8d32a8cd34ca5af1d19e5e12e20e","original_commit_id":"6ed8e94c8bbd8d32a8cd34ca5af1d19e5e12e20e","user":{"login":"wilsonge","id":1986000,"avatar_url":"https://avatars.githubusercontent.com/u/1986000?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonge","html_url":"https://github.com/wilsonge","followers_url":"https://api.github.com/users/wilsonge/followers","following_url":"https://api.github.com/users/wilsonge/following{/other_user}","gists_url":"https://api.github.com/users/wilsonge/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonge/subscriptions","organizations_url":"https://api.github.com/users/wilsonge/orgs","repos_url":"https://api.github.com/users/wilsonge/repos","events_url":"https://api.github.com/users/wilsonge/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonge/received_events","type":"User","site_admin":false},"body":"I'm nervous about introducing component deps into libraries (this is an ongoing debate). Is this really giving us anything? If the article itself has no language then should be really set a language at all even if there is a default site one...","created_at":"2016-09-16T09:23:51Z","updated_at":"2016-09-16T09:25:23Z","html_url":"https://github.com/joomla/joomla-cms/pull/12049#discussion_r79134336","pull_request_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/12049","_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/79134336"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/12049#discussion_r79134336"},"pull_request":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/12049"}}},"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/12049","id":85502413,"html_url":"https://github.com/joomla/joomla-cms/pull/12049","diff_url":"https://github.com/joomla/joomla-cms/pull/12049.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/12049.patch","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/12049","number":12049,"state":"open","locked":false,"title":"Improve creation filesystem-safe filenames, by using multiple language transliterations","user":{"login":"ggppdk","id":5092940,"avatar_url":"https://avatars.githubusercontent.com/u/5092940?v=3","gravatar_id":"","url":"https://api.github.com/users/ggppdk","html_url":"https://github.com/ggppdk","followers_url":"https://api.github.com/users/ggppdk/followers","following_url":"https://api.github.com/users/ggppdk/following{/other_user}","gists_url":"https://api.github.com/users/ggppdk/gists{/gist_id}","starred_url":"https://api.github.com/users/ggppdk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ggppdk/subscriptions","organizations_url":"https://api.github.com/users/ggppdk/orgs","repos_url":"https://api.github.com/users/ggppdk/repos","events_url":"https://api.github.com/users/ggppdk/events{/privacy}","received_events_url":"https://api.github.com/users/ggppdk/received_events","type":"User","site_admin":false},"body":"Pull Request for Issue #7841\r\n\r\n### Summary of Changes\r\n1. Multiple transliterations are tried\r\n2. [RFC] In order to avoid ugly looking empty filenames, current time is used if alls transliteration fail to do a complete job\r\n\r\n### Testing Instructions\r\nUpload files that are using characters in SITE or ADMIN default language of your website\r\n- Filenames should be transliterated\r\n\r\nPlease also do a code review if you can\r\n\r\n### Documentation Changes Required\r\nA new optional parameter $language = null is added to the method ... for doing a specific language transliteration\r\n","created_at":"2016-09-16T00:17:22Z","updated_at":"2016-09-16T09:25:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b4fb9bc92d83c99ca0a49a3be28a4edb2dad1e7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/12049/commits","review_comments_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/12049/comments","review_comment_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/12049/comments","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/6ed8e94c8bbd8d32a8cd34ca5af1d19e5e12e20e","head":{"label":"ggppdk:patch-24","ref":"patch-24","sha":"6ed8e94c8bbd8d32a8cd34ca5af1d19e5e12e20e","user":{"login":"ggppdk","id":5092940,"avatar_url":"https://avatars.githubusercontent.com/u/5092940?v=3","gravatar_id":"","url":"https://api.github.com/users/ggppdk","html_url":"https://github.com/ggppdk","followers_url":"https://api.github.com/users/ggppdk/followers","following_url":"https://api.github.com/users/ggppdk/following{/other_user}","gists_url":"https://api.github.com/users/ggppdk/gists{/gist_id}","starred_url":"https://api.github.com/users/ggppdk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ggppdk/subscriptions","organizations_url":"https://api.github.com/users/ggppdk/orgs","repos_url":"https://api.github.com/users/ggppdk/repos","events_url":"https://api.github.com/users/ggppdk/events{/privacy}","received_events_url":"https://api.github.com/users/ggppdk/received_events","type":"User","site_admin":false},"repo":{"id":57083813,"name":"joomla-cms","full_name":"ggppdk/joomla-cms","owner":{"login":"ggppdk","id":5092940,"avatar_url":"https://avatars.githubusercontent.com/u/5092940?v=3","gravatar_id":"","url":"https://api.github.com/users/ggppdk","html_url":"https://github.com/ggppdk","followers_url":"https://api.github.com/users/ggppdk/followers","following_url":"https://api.github.com/users/ggppdk/following{/other_user}","gists_url":"https://api.github.com/users/ggppdk/gists{/gist_id}","starred_url":"https://api.github.com/users/ggppdk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ggppdk/subscriptions","organizations_url":"https://api.github.com/users/ggppdk/orgs","repos_url":"https://api.github.com/users/ggppdk/repos","events_url":"https://api.github.com/users/ggppdk/events{/privacy}","received_events_url":"https://api.github.com/users/ggppdk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ggppdk/joomla-cms","description":"Home of the Joomla! Content Management System","fork":true,"url":"https://api.github.com/repos/ggppdk/joomla-cms","forks_url":"https://api.github.com/repos/ggppdk/joomla-cms/forks","keys_url":"https://api.github.com/repos/ggppdk/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ggppdk/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ggppdk/joomla-cms/teams","hooks_url":"https://api.github.com/repos/ggppdk/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/ggppdk/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/ggppdk/joomla-cms/events","assignees_url":"https://api.github.com/repos/ggppdk/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/ggppdk/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/ggppdk/joomla-cms/tags","blobs_url":"https://api.github.com/repos/ggppdk/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ggppdk/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ggppdk/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/ggppdk/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ggppdk/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/ggppdk/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/ggppdk/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/ggppdk/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/ggppdk/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/ggppdk/joomla-cms/subscription","commits_url":"https://api.github.com/repos/ggppdk/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/ggppdk/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/ggppdk/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/ggppdk/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/ggppdk/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/ggppdk/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ggppdk/joomla-cms/merges","archive_url":"https://api.github.com/repos/ggppdk/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ggppdk/joomla-cms/downloads","issues_url":"https://api.github.com/repos/ggppdk/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/ggppdk/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/ggppdk/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/ggppdk/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ggppdk/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/ggppdk/joomla-cms/releases{/id}","deployments_url":"https://api.github.com/repos/ggppdk/joomla-cms/deployments","created_at":"2016-04-25T23:51:51Z","updated_at":"2016-04-25T23:52:04Z","pushed_at":"2016-09-16T00:10:13Z","git_url":"git://github.com/ggppdk/joomla-cms.git","ssh_url":"git@github.com:ggppdk/joomla-cms.git","clone_url":"https://github.com/ggppdk/joomla-cms.git","svn_url":"https://github.com/ggppdk/joomla-cms","homepage":"https://www.joomla.org","size":156091,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"staging"}},"base":{"label":"joomla:staging","ref":"staging","sha":"91749f845dcf20e097801ecd75da8e4665075a18","user":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"repo":{"id":2464908,"name":"joomla-cms","full_name":"joomla/joomla-cms","owner":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla/joomla-cms","description":"Home of the Joomla! Content Management System","fork":false,"url":"https://api.github.com/repos/joomla/joomla-cms","forks_url":"https://api.github.com/repos/joomla/joomla-cms/forks","keys_url":"https://api.github.com/repos/joomla/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla/joomla-cms/teams","hooks_url":"https://api.github.com/repos/joomla/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/joomla/joomla-cms/events","assignees_url":"https://api.github.com/repos/joomla/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/joomla/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/joomla/joomla-cms/tags","blobs_url":"https://api.github.com/repos/joomla/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/joomla/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/joomla/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/joomla/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/joomla/joomla-cms/subscription","commits_url":"https://api.github.com/repos/joomla/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/joomla/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/joomla/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla/joomla-cms/merges","archive_url":"https://api.github.com/repos/joomla/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla/joomla-cms/downloads","issues_url":"https://api.github.com/repos/joomla/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/joomla/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/joomla/joomla-cms/releases{/id}","deployments_url":"https://api.github.com/repos/joomla/joomla-cms/deployments","created_at":"2011-09-27T02:07:38Z","updated_at":"2016-09-15T01:35:35Z","pushed_at":"2016-09-16T09:06:26Z","git_url":"git://github.com/joomla/joomla-cms.git","ssh_url":"git@github.com:joomla/joomla-cms.git","clone_url":"https://github.com/joomla/joomla-cms.git","svn_url":"https://github.com/joomla/joomla-cms","homepage":"https://www.joomla.org","size":295275,"stargazers_count":2137,"watchers_count":2137,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2289,"mirror_url":null,"open_issues_count":430,"forks":2289,"open_issues":430,"watchers":2137,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/12049"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/12049"},"issue":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/12049"},"comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/12049/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/12049/comments"},"review_comment":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/12049/commits"},"statuses":{"href":"https://api.github.com/repos/joomla/joomla-cms/statuses/6ed8e94c8bbd8d32a8cd34ca5af1d19e5e12e20e"}}}}
{"actor":{"display_login":"wilsonge"}}