{"action":"created","issue":{"url":"https://api.github.com/repos/sass/libsass/issues/674","labels_url":"https://api.github.com/repos/sass/libsass/issues/674/labels{/name}","comments_url":"https://api.github.com/repos/sass/libsass/issues/674/comments","events_url":"https://api.github.com/repos/sass/libsass/issues/674/events","html_url":"https://github.com/sass/libsass/issues/674","id":49876902,"number":674,"title":"Users cannot safely redefine url()","user":{"login":"jakob-e","id":1699461,"avatar_url":"https://avatars.githubusercontent.com/u/1699461?v=3","gravatar_id":"","url":"https://api.github.com/users/jakob-e","html_url":"https://github.com/jakob-e","followers_url":"https://api.github.com/users/jakob-e/followers","following_url":"https://api.github.com/users/jakob-e/following{/other_user}","gists_url":"https://api.github.com/users/jakob-e/gists{/gist_id}","starred_url":"https://api.github.com/users/jakob-e/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakob-e/subscriptions","organizations_url":"https://api.github.com/users/jakob-e/orgs","repos_url":"https://api.github.com/users/jakob-e/repos","events_url":"https://api.github.com/users/jakob-e/events{/privacy}","received_events_url":"https://api.github.com/users/jakob-e/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sass/libsass/labels/regression","name":"regression","color":"FF0066"},{"url":"https://api.github.com/repos/sass/libsass/labels/test%20written","name":"test written","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/sass/libsass/milestones/11","html_url":"https://github.com/sass/libsass/milestones/3.3.1","labels_url":"https://api.github.com/repos/sass/libsass/milestones/11/labels","id":1157617,"number":11,"title":"3.3.1","description":"","creator":{"login":"xzyfer","id":579928,"avatar_url":"https://avatars.githubusercontent.com/u/579928?v=3","gravatar_id":"","url":"https://api.github.com/users/xzyfer","html_url":"https://github.com/xzyfer","followers_url":"https://api.github.com/users/xzyfer/followers","following_url":"https://api.github.com/users/xzyfer/following{/other_user}","gists_url":"https://api.github.com/users/xzyfer/gists{/gist_id}","starred_url":"https://api.github.com/users/xzyfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xzyfer/subscriptions","organizations_url":"https://api.github.com/users/xzyfer/orgs","repos_url":"https://api.github.com/users/xzyfer/repos","events_url":"https://api.github.com/users/xzyfer/events{/privacy}","received_events_url":"https://api.github.com/users/xzyfer/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":2,"state":"open","created_at":"2015-06-09T21:39:16Z","updated_at":"2015-06-15T00:30:57Z","due_on":"2015-08-30T22:00:00Z","closed_at":null},"comments":6,"created_at":"2014-11-24T10:53:13Z","updated_at":"2015-06-26T06:44:29Z","closed_at":null,"body":"\r\nIt seems like the problem is isolated to the case where you pass more than \r\none argument to @function url($arg1, **$arg2: ''**) { ... } \r\n\r\nMy tests shows that:\r\n- attr() works with multiple arguments\r\n- omitting the second argument works\r\n- local function variables and global works  \r\n\r\n**Note!** When passing the second argument the last character of the first argument is removed\r\n\r\n````SCSS\r\n\r\n$base-path:'../images/';\r\n$base-attr:'data-';\r\n\r\n@function url($src, $path:''){\r\n  @return unquote('url('+$base-path + $path+ $src +')');\r\n}\r\n@function url2($src, $path:''){\r\n  @return unquote('url('+ $base-path + $path+ $src +')');\r\n}\r\n@function attr($arg1, $arg2:''){\r\n  @return unquote('attr('+$base-attr + $arg1 + $arg2 +')');\r\n}\r\n\r\ndiv {\r\n    background: url('image.png');\r\n    background: url('image.png','img/');\r\n    background: url2('image.png','img/');\r\n  \r\n  &:after {\r\n    content: attr(value);\r\n    content: attr(value, -extra);\r\n    content: url('icon.png');\r\n    content: url('icon.png','gfx/');\r\n    content: url2('icon.png','gfx/');\r\n  }\r\n}\r\n\r\n\r\n````\r\n\r\n````CSS\r\n/* Output */\r\ndiv {\r\n  background: url(../images/image.png);\r\n  background: url(../images/image.pn','img/); /* <= Fails */\r\n  background: url(../images/img/image.png); \r\n}\r\ndiv:after {\r\n  content: attr(data-value);\r\n  content: attr(data-value-extra);\r\n  content: url(../images/icon.png);\r\n  content: url(../images/icon.pn','gfx/); /* <= Fails */\r\n  content: url(../images/gfx/icon.png); \r\n}\r\n\r\n\r\n/* Expected */\r\ndiv {\r\n  background: url(../images/image.png);\r\n  background: url(../images/img/image.png);\r\n  background: url(../images/img/image.png);\r\n}\r\ndiv:after {\r\n  content: attr(data-value);\r\n  content: attr(data-value-extra);\r\n  content: url(../images/icon.png);\r\n  content: url(../images/gfx/icon.png);\r\n  content: url(../images/gfx/icon.png);\r\n}\r\n\r\n\r\n\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/6478672-users-cannot-safely-redefine-url?utm_campaign=plugin&utm_content=tracker%2F283068&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F283068&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/sass/libsass/issues/comments/115546629","html_url":"https://github.com/sass/libsass/issues/674#issuecomment-115546629","issue_url":"https://api.github.com/repos/sass/libsass/issues/674","id":115546629,"user":{"login":"am11","id":3840695,"avatar_url":"https://avatars.githubusercontent.com/u/3840695?v=3","gravatar_id":"","url":"https://api.github.com/users/am11","html_url":"https://github.com/am11","followers_url":"https://api.github.com/users/am11/followers","following_url":"https://api.github.com/users/am11/following{/other_user}","gists_url":"https://api.github.com/users/am11/gists{/gist_id}","starred_url":"https://api.github.com/users/am11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/am11/subscriptions","organizations_url":"https://api.github.com/users/am11/orgs","repos_url":"https://api.github.com/users/am11/repos","events_url":"https://api.github.com/users/am11/events{/privacy}","received_events_url":"https://api.github.com/users/am11/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T06:44:28Z","updated_at":"2015-06-26T06:44:28Z","body":"With regard to https://github.com/sass/libsass/issues/532, IMHO the relative paths feature can be implemented as a special case in extensible manner; providing most-common functionality OOTB.\r\n\r\n* Add relative-paths option (default: false to remain conformant with ruby-sass).\r\n* When the option is set, on compile compiler will first resolve the value and call a virtual function with default implementation:\r\n  * `Sass_Value(char* input_file, char* output_file, char* value_file, char* transient_file, char* parsed_value, char* evaluated_value)`, where:\r\n    * `input_file:` absolute path of file being compiled.\r\n    * `output_file` absolute path to user intended output file.\r\n    * `value_file` absolute path to file which encountered the value.\r\n    * `transient_file` in case where, for example, a mixin or a variable is defined, this path is the file containing the mixin and variable and it could be different that the value_file where it is ultimately consumed. Note `import` and `implode` may have different implications in path resolution. :smile: \r\n    * `parsed_value` raw value encountered by the parser\r\n    * `evaluated_value` evaluated value, which is written to output today.\r\n  * Return `evaluated_value` as is, if one of the following is encountered (defensive programming):\r\n    * Absolute Path\r\n    * URL\r\n    * CSS4 variable.\r\n    * Any invalid path character (which could be meant for post-processing)\r\n  * Resolve and return relative path as: `relative(input_file, relative(value_file, evaluated_value))`.\r\n* Expose same signature on API (perhaps as `path_handler`), so down-streams can override the default behavior.\r\n\r\n"}}