| 317 | |
| 318 | // optional: mirror PHP self/descendant guard so we fail fast |
| 319 | const norm = s => { |
| 320 | if (!s) return ''; |
| 321 | return s.replace(/^[/\\]+|[/\\]+$/g, ''); |
| 322 | }; |
| 323 | const srcNorm = norm(source); |
| 324 | const dstNorm = destination === 'root' ? '' : norm(destination); |
| 325 |