All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] toaster: correctly handle quotes in project names
@ 2016-03-09 14:52 Elliot Smith
  2016-03-10 11:24 ` Michael Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Elliot Smith @ 2016-03-09 14:52 UTC (permalink / raw)
  To: toaster

A project name like "Elliot's project" causes the "Rebuild" buttons
in the most recent builds section to fail when clicked with:

Uncaught SyntaxError: Unexpected token ILLEGAL

This is because the single quote character causes the JavaScript
for handling the button click event to be badly-formed.

As the project name is passed to the scheduleBuild() function
but doesn't actually do anything, this can be fixed by removing
the project name from the arguments passed to scheduleBuild()
(as well as the project URL, which is also ignored).

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 bitbake/lib/toaster/toastergui/templates/mrb_section.html | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
index 551e341..f43390f 100644
--- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
+++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
@@ -109,10 +109,7 @@
                       {%endif%}
                       pull-right"
                       onclick='scheduleBuild({% url 'projectbuilds' build.project.id as bpi %}{{bpi|json}},
-                        {{build.project.name|json}},
-                        {% url 'project' build.project.id as purl %}{{purl|json}},
                         {{build.target_set.all|get_tasks|json}})'>
-
                         Rebuild
                   </button>
               {% endif %}
@@ -134,7 +131,7 @@
 
 <script>
 
-function scheduleBuild(url, projectName, projectUrl, buildlist) {
+function scheduleBuild(url, buildlist) {
   console.log("scheduleBuild");
   libtoaster.startABuild(url, null, buildlist.join(" "), function(){
     console.log("reloading page");
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] toaster: correctly handle quotes in project names
  2016-03-09 14:52 [PATCH] toaster: correctly handle quotes in project names Elliot Smith
@ 2016-03-10 11:24 ` Michael Wood
  2016-03-10 11:35   ` Smith, Elliot
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Wood @ 2016-03-10 11:24 UTC (permalink / raw)
  To: toaster

I think this is fixed here already so much be better to just wait for 
the build cancel stuff to be merged?

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/diff/bitbake/lib/toaster/toastergui/static/js/mrbsection.js?h=michaelw/sujith/build-cancel&id=1dfe119322cc7ab35e489bc83f9bcc49b087b0c4

Michael

On 09/03/16 14:52, Elliot Smith wrote:
> A project name like "Elliot's project" causes the "Rebuild" buttons
> in the most recent builds section to fail when clicked with:
>
> Uncaught SyntaxError: Unexpected token ILLEGAL
>
> This is because the single quote character causes the JavaScript
> for handling the button click event to be badly-formed.
>
> As the project name is passed to the scheduleBuild() function
> but doesn't actually do anything, this can be fixed by removing
> the project name from the arguments passed to scheduleBuild()
> (as well as the project URL, which is also ignored).
>
> Signed-off-by: Elliot Smith <elliot.smith@intel.com>
> ---
>   bitbake/lib/toaster/toastergui/templates/mrb_section.html | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
> index 551e341..f43390f 100644
> --- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
> +++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
> @@ -109,10 +109,7 @@
>                         {%endif%}
>                         pull-right"
>                         onclick='scheduleBuild({% url 'projectbuilds' build.project.id as bpi %}{{bpi|json}},
> -                        {{build.project.name|json}},
> -                        {% url 'project' build.project.id as purl %}{{purl|json}},
>                           {{build.target_set.all|get_tasks|json}})'>
> -
>                           Rebuild
>                     </button>
>                 {% endif %}
> @@ -134,7 +131,7 @@
>   
>   <script>
>   
> -function scheduleBuild(url, projectName, projectUrl, buildlist) {
> +function scheduleBuild(url, buildlist) {
>     console.log("scheduleBuild");
>     libtoaster.startABuild(url, null, buildlist.join(" "), function(){
>       console.log("reloading page");



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] toaster: correctly handle quotes in project names
  2016-03-10 11:24 ` Michael Wood
@ 2016-03-10 11:35   ` Smith, Elliot
  0 siblings, 0 replies; 3+ messages in thread
From: Smith, Elliot @ 2016-03-10 11:35 UTC (permalink / raw)
  To: Michael Wood; +Cc: toaster

[-- Attachment #1: Type: text/plain, Size: 2723 bytes --]

Great, yes, ignore my patch in that case.

Elliot

On 10 March 2016 at 11:24, Michael Wood <michael.g.wood@intel.com> wrote:

> I think this is fixed here already so much be better to just wait for the
> build cancel stuff to be merged?
>
>
> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/diff/bitbake/lib/toaster/toastergui/static/js/mrbsection.js?h=michaelw/sujith/build-cancel&id=1dfe119322cc7ab35e489bc83f9bcc49b087b0c4
>
> Michael
>
>
> On 09/03/16 14:52, Elliot Smith wrote:
>
>> A project name like "Elliot's project" causes the "Rebuild" buttons
>> in the most recent builds section to fail when clicked with:
>>
>> Uncaught SyntaxError: Unexpected token ILLEGAL
>>
>> This is because the single quote character causes the JavaScript
>> for handling the button click event to be badly-formed.
>>
>> As the project name is passed to the scheduleBuild() function
>> but doesn't actually do anything, this can be fixed by removing
>> the project name from the arguments passed to scheduleBuild()
>> (as well as the project URL, which is also ignored).
>>
>> Signed-off-by: Elliot Smith <elliot.smith@intel.com>
>> ---
>>   bitbake/lib/toaster/toastergui/templates/mrb_section.html | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
>> b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
>> index 551e341..f43390f 100644
>> --- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
>> +++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
>> @@ -109,10 +109,7 @@
>>                         {%endif%}
>>                         pull-right"
>>                         onclick='scheduleBuild({% url 'projectbuilds'
>> build.project.id as bpi %}{{bpi|json}},
>> -                        {{build.project.name|json}},
>> -                        {% url 'project' build.project.id as purl
>> %}{{purl|json}},
>>                           {{build.target_set.all|get_tasks|json}})'>
>> -
>>                           Rebuild
>>                     </button>
>>                 {% endif %}
>> @@ -134,7 +131,7 @@
>>     <script>
>>   -function scheduleBuild(url, projectName, projectUrl, buildlist) {
>> +function scheduleBuild(url, buildlist) {
>>     console.log("scheduleBuild");
>>     libtoaster.startABuild(url, null, buildlist.join(" "), function(){
>>       console.log("reloading page");
>>
>
> --
> _______________________________________________
> toaster mailing list
> toaster@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/toaster
>



-- 
Elliot Smith
Software Engineer
Intel Open Source Technology Centre

[-- Attachment #2: Type: text/html, Size: 4236 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-10 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 14:52 [PATCH] toaster: correctly handle quotes in project names Elliot Smith
2016-03-10 11:24 ` Michael Wood
2016-03-10 11:35   ` Smith, Elliot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.