diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 65b38d0645..851e962c05 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -2362,6 +2362,27 @@ if True: | |||
2362 | 2362 | ||
2363 | # create custom recipe | 2363 | # create custom recipe |
2364 | try: | 2364 | try: |
2365 | |||
2366 | # Only allowed chars in name are a-z, 0-9 and - | ||
2367 | if re.search(r'[^a-z|0-9|-]', request.POST["name"]): | ||
2368 | return {"error": "invalid-name"} | ||
2369 | |||
2370 | # Are there any recipes with the name already? | ||
2371 | for existing_recipe in Recipe.objects.filter( | ||
2372 | name=request.POST["name"]): | ||
2373 | try: | ||
2374 | ci = CustomImageRecipe.objects.get(pk=existing_recipe.pk) | ||
2375 | if ci.project == params["project"]: | ||
2376 | return {"error": "already-exists" } | ||
2377 | else: | ||
2378 | # It is a CustomImageRecipe but not in our project | ||
2379 | # this is fine so | ||
2380 | continue | ||
2381 | except: | ||
2382 | # It isn't a CustomImageRecipe so is a recipe from | ||
2383 | # another source. | ||
2384 | return {"error": "already-exists" } | ||
2385 | |||
2365 | # create layer 'Custom layer' and verion if needed | 2386 | # create layer 'Custom layer' and verion if needed |
2366 | layer = Layer.objects.get_or_create( | 2387 | layer = Layer.objects.get_or_create( |
2367 | name="toaster-custom-images", | 2388 | name="toaster-custom-images", |