Browse Source

Normalize all line endings in an OBJ file (#9633)

`String.prototype.replace` only targets and replaces the first occurrence of a string. By using a regex with the global flag, all instances of a pattern are replaced.
Daniel Hritzkiv 9 years ago
parent
commit
89b3d0babe
1 changed files with 1 additions and 1 deletions
  1. 1 1
      examples/js/loaders/OBJLoader.js

+ 1 - 1
examples/js/loaders/OBJLoader.js

@@ -412,7 +412,7 @@ THREE.OBJLoader.prototype = {
 		if ( text.indexOf( '\r\n' ) !== - 1 ) {
 
 			// This is faster than String.split with regex that splits on both
-			text = text.replace( '\r\n', '\n' );
+			text = text.replace( /\r\n/g, '\n' );
 
 		}