fix fd.c bugs
This commit is contained in:
@@ -9923,7 +9923,7 @@ static JSValue js_blob_constructor (JSContext *ctx, JSValue this_val, int argc,
|
||||
}
|
||||
}
|
||||
/* blob(blob, from, to) - copy from another blob */
|
||||
else if (argc >= 1 && JS_IsObject (argv[0])) {
|
||||
else if (argc >= 1 && JS_IsObject (argv[0]) && !JS_IsText (argv[0])) {
|
||||
blob *src = js_get_blob (ctx, argv[0]);
|
||||
if (!src)
|
||||
return JS_ThrowTypeError (ctx,
|
||||
@@ -9941,9 +9941,7 @@ static JSValue js_blob_constructor (JSContext *ctx, JSValue this_val, int argc,
|
||||
bd = blob_new_from_blob (src, (size_t)from, (size_t)to);
|
||||
}
|
||||
/* blob(text) - create blob from UTF-8 string */
|
||||
else if (argc == 1
|
||||
&& (JS_VALUE_GET_TAG (argv[0]) == JS_TAG_STRING
|
||||
|| JS_VALUE_GET_TAG (argv[0]) == JS_TAG_STRING_IMM)) {
|
||||
else if (argc == 1 && JS_IsText (argv[0])) {
|
||||
const char *str = JS_ToCString (ctx, argv[0]);
|
||||
if (!str) return JS_EXCEPTION;
|
||||
size_t len = strlen (str);
|
||||
|
||||
Reference in New Issue
Block a user