[Sugar-devel] [PATCH Browse] Pass URI instead of file path when the activity starts from a file

Simon Schampijer simon at schampijer.de
Wed Mar 28 15:17:04 EDT 2012


On 03/28/2012 08:46 PM, Manuel Quiñones wrote:
> If the MIME type of the file that the activity reads is not
> "text/plain" or "text/uri-list", it will load the file as-is in the
> default tab.  But WebKit needs an URI, and we are passing the file
> path.  Appending 'file://' to the file path solves the issue.
>
> This fixes second part of #3300 .
>
> Signed-off-by: Manuel Quiñones<manuq at laptop.org>
> ---
>   webactivity.py |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/webactivity.py b/webactivity.py
> index 29258e6..e156173 100644
> --- a/webactivity.py
> +++ b/webactivity.py
> @@ -400,7 +400,8 @@ class WebActivity(activity.Activity):
>                   _logger.error('Open uri-list: Does not support'
>                                 'list of multiple uris by now.')
>           else:
> -            self._tabbed_view.props.current_browser.load_uri(file_path)
> +            file_uri = 'file://' + file_path
> +            self._tabbed_view.props.current_browser.load_uri(file_uri)
>
>       def write_file(self, file_path):
>           if not self.metadata['mime_type']:

Ok, looks good to me. Please push.

Simon


More information about the Sugar-devel mailing list