This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new 062ecbe  AVRO-2559: schema.indexOf(/)is not compatible on windows 
(#648)
062ecbe is described below

commit 062ecbedd7ee9f29a5dae374eeba419f8ab23c0d
Author: Zezeng Wang <[email protected]>
AuthorDate: Mon Sep 30 13:02:04 2019 +0800

    AVRO-2559: schema.indexOf(/)is not compatible on windows (#648)
---
 lang/js/lib/files.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lang/js/lib/files.js b/lang/js/lib/files.js
index d1a45c2..386d794 100644
--- a/lang/js/lib/files.js
+++ b/lang/js/lib/files.js
@@ -27,6 +27,7 @@ var protocols = require('./protocols'),
     fs = require('fs'),
     stream = require('stream'),
     util = require('util'),
+    path = require('path'),
     zlib = require('zlib');
 
 // Type of Avro header.
@@ -639,7 +640,7 @@ function loadSchema(schema) {
     try {
       obj = JSON.parse(schema);
     } catch (err) {
-      if (~schema.indexOf('/')) {
+      if (~schema.indexOf(path.sep)) {
         // This can't be a valid name, so we interpret is as a filepath. This
         // makes is always feasible to read a file, independent of its name
         // (i.e. even if its name is valid JSON), by prefixing it with `./`.

Reply via email to