File tree 2 files changed +20
-3
lines changed
2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ function readPackage(requestPath) {
67
67
}
68
68
69
69
var jsonPath = path . resolve ( requestPath , 'package.json' ) ;
70
- var json = internalModuleReadFile ( jsonPath ) ;
70
+ var json = internalModuleReadFile ( path . _makeLong ( jsonPath ) ) ;
71
71
72
72
if ( json === undefined ) {
73
73
return false ;
@@ -100,7 +100,7 @@ Module._realpathCache = {};
100
100
101
101
// check if the file exists and is not a directory
102
102
function tryFile ( requestPath ) {
103
- const rc = internalModuleStat ( requestPath ) ;
103
+ const rc = internalModuleStat ( path . _makeLong ( requestPath ) ) ;
104
104
return rc === 0 && toRealPath ( requestPath ) ;
105
105
}
106
106
@@ -146,7 +146,7 @@ Module._findPath = function(request, paths) {
146
146
var filename ;
147
147
148
148
if ( ! trailingSlash ) {
149
- const rc = internalModuleStat ( basePath ) ;
149
+ const rc = internalModuleStat ( path . _makeLong ( basePath ) ) ;
150
150
if ( rc === 0 ) { // File.
151
151
filename = toRealPath ( basePath ) ;
152
152
} else if ( rc === 1 ) { // Directory.
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ var common = require ( '../common' ) ;
3
+ var fs = require ( 'fs' ) ;
4
+ var path = require ( 'path' ) ;
5
+ var assert = require ( 'assert' ) ;
6
+
7
+ // make a path that is more than 260 chars long.
8
+ var fileNameLen = Math . max ( 261 - common . tmpDir . length - 1 , 1 ) ;
9
+ var fileName = path . join ( common . tmpDir , new Array ( fileNameLen + 1 ) . join ( 'x' ) ) ;
10
+ var fullPath = path . resolve ( fileName ) ;
11
+
12
+ common . refreshTmpDir ( ) ;
13
+ fs . writeFileSync ( fullPath , 'module.exports = 42;' ) ;
14
+
15
+ assert . equal ( require ( fullPath ) , 42 ) ;
16
+
17
+ fs . unlinkSync ( fullPath ) ;
You can’t perform that action at this time.
0 commit comments