Skip to content

Commit ef0081c

Browse files
author
root
committed
Fixes #32
1 parent 8ebfc9e commit ef0081c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<name>Cookbook</name>
66
<summary>An integrated cookbook using schema.org JSON files as recipes</summary>
77
<description><![CDATA[A library for all your recipes. It uses JSON files following the schema.org recipe format. To add a recipe to the collection, you can paste in the URL of the recipe, and the provided web page will be parsed and downloaded to whichever folder you specify in the app settings.]]></description>
8-
<version>0.1.10</version>
8+
<version>0.1.11</version>
99
<licence>agpl</licence>
1010
<author mail="[email protected]" >Jeppe Zapp</author>
1111
<namespace>Cookbook</namespace>

js/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Cookbook.prototype = {
3030
var deferred = $.Deferred();
3131
var self = this;
3232
$.ajax({
33-
url: this._baseUrl + '/update?id=' + id,
33+
url: this._baseUrl + '/update' + (id ? '?id=' + id : ''),
3434
method: 'POST',
3535
data: json
3636
}).done(function (response) {
@@ -44,7 +44,7 @@ Cookbook.prototype = {
4444
location.hash = id;
4545
},
4646
getActiveId: function () {
47-
return parseInt(location.hash.replace( /[^0-9]/g, ''));
47+
return parseInt(location.hash.replace( /[^0-9]/g, '')) || null;
4848
},
4949
add: function (url) {
5050
var deferred = $.Deferred();

lib/Controller/RecipeController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ public function get() {
107107
* @NoCSRFRequired
108108
*/
109109
public function update() {
110-
if(!isset($_GET['id'])) { return new DataResponse('Parameter "id" is required', 400); }
111110

112111
$json = $_POST;
113-
$id = $_GET['id'];
114-
115-
$this->service->deleteRecipe($id);
112+
113+
if(isset($_GET['id'])) {
114+
$this->service->deleteRecipe($_GET['id']);
115+
}
116116

117117
$file = $this->service->addRecipe($json);
118118

0 commit comments

Comments
 (0)