Skip to content

Files cannot be uploaded to FTP server when included by Composer from a local 'path' repository #8781

Open

Description

@standardpavel

Apache NetBeans version

Apache NetBeans 27

What happened

Files cannot be uploaded to FTP server when included by Composer from a local 'path' repository.

This started happening after I switched from NetBeans 17 to NetBeans 26, and updating to NetBeans 27 has not helped.

Language / Project Type / NetBeans Component

PHP Composer project

How to reproduce

Create basic composer project and inside composer.json file, include something like this:

    "repositories": [
        {
            "type": "path",
            "url": "../../../Global Libs/dbi/dbi_libs"
        }
    ],
    "require": {
        "sps/dbi": "*"
    }

Then in terminal on the project folder run composer update

This should create the appropriate 'vendor' directory which includes the files from the source you specified in the composer.json file.

When right-clicking on the 'vendor' folder and selecting upload, it will not upload any of the files from the source you specified in composer.json

Did this work correctly in an earlier version?

Apache NetBeans 24 or earlier

Operating System

Windlows 11

JDK

24

Apache NetBeans packaging

FoAN provided installer

Anything else

When viewing the directory in Windows Explorer
project > vendor > sps

Image

Are you willing to submit a pull request?

No

Activity

  1. added
    PHP[ci] enable extra PHP tests (php/php.editor)
    on Sep 3, 2025
  2. UltraVioletDragon commented on Sep 6, 2025

    @UltraVioletDragon

    Maybe same issue. Begin from version 26 (and exist in 27). Try upload file from folder symbolic link and nothing happens, but exception:

    java.lang.IllegalArgumentException: File 'C:\Project\web\vendor_folder\yii2-shared-middleware\SomeFile.php' must be underneath base directory 'C:\Project\web\current_project'
    at org.netbeans.modules.php.project.connections.transfer.LocalTransferFile.(LocalTransferFile.java:52)
    at org.netbeans.modules.php.project.connections.transfer.TransferFile.fromFile(TransferFile.java:168)
    at org.netbeans.modules.php.project.connections.transfer.TransferFile.fromFileObject(TransferFile.java:117)
    at org.netbeans.modules.php.project.connections.RemoteClient.prepareUpload(RemoteClient.java:283)
    at org.netbeans.modules.php.project.ui.actions.UploadCommand.prepareUpload(UploadCommand.java:106)
    at org.netbeans.modules.php.project.ui.actions.UploadCommand.uploadFiles(UploadCommand.java:97)
    at org.netbeans.modules.php.project.ui.actions.UploadCommand.invokeActionImpl(UploadCommand.java:82)
    at org.netbeans.modules.php.project.ui.actions.UploadCommand$1.run(UploadCommand.java:69)
    at org.netbeans.modules.php.project.ui.actions.RemoteCommand$1.run(RemoteCommand.java:83)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1403)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
    [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2018)

    File upload by path C:\Project\web\current_project\vendor\yii2-shared-middleware\SomeFile.php
    C:\Project\web\current_project\vendor\yii2-shared-middleware\ is symbolic folder C:\Project\web\vendor_folder

  3. matthiasblaesing commented on Oct 22, 2025

    @matthiasblaesing
    Contributor

    I tested this without composer and creating a symlink on windows pointing outside the directory will yield this exception if JDK24 is used.

    I suspect we see fallout from https://bugs.openjdk.org/browse/JDK-8355342 here too. We might have to rework the check in the FTP integration, but before we do this, we should wait how the situation will look with a fix for the referenced issue.

  4. added and removed
    needs:triageRequires attention from one of the committers
    on Oct 22, 2025
  5. UltraVioletDragon commented on Aug 17, 2026

    @UltraVioletDragon

    Bug still exists in JDK 26 and NetBeans 31

    java.lang.IllegalArgumentException: File 'C:\Project\web\vendor_folder\yii2-shared-middleware' must be underneath base directory 'C:\Project\web\current_project'
    at org.netbeans.modules.php.project.connections.transfer.LocalTransferFile.(LocalTransferFile.java:52)
    at org.netbeans.modules.php.project.connections.transfer.TransferFile.fromFile(TransferFile.java:168)
    at org.netbeans.modules.php.project.connections.transfer.TransferFile.fromFile(TransferFile.java:132)
    at org.netbeans.modules.php.project.connections.RemoteClient.prepareDownload(RemoteClient.java:577)
    at org.netbeans.modules.php.project.connections.RemoteClient.prepareDownload(RemoteClient.java:558)
    at org.netbeans.modules.php.project.ui.actions.DownloadCommand.prepareDownload(DownloadCommand.java:120)
    at org.netbeans.modules.php.project.ui.actions.DownloadCommand.download(DownloadCommand.java:109)
    at org.netbeans.modules.php.project.ui.actions.DownloadCommand.invokeActionImpl(DownloadCommand.java:93)
    at org.netbeans.modules.php.project.ui.actions.DownloadCommand$1.run(DownloadCommand.java:71)
    at org.netbeans.modules.php.project.ui.actions.RemoteCommand$1.run(RemoteCommand.java:83)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1370)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
    [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1981)

  6. matthiasblaesing commented on Sep 29, 2026

    @matthiasblaesing
    Contributor

    Steps to reproduce locally:

    cd c:\temp
    mkdir comp-test
    mkdir comp-test\lib
    mkdir comp-test\consumer
    cd comp-test\lib
    composer init

    Package name: demo/lib
    Everything else empty/default

    cd ..
    cd consumer
    composer init

    Package name: consumer
    Everything else empty/default

    Update composer.json in consumer:

    {
      // ...
      "repositories": [{
        "type": "path",
        "url": "../lib"
      }],
      "require": {
         "demo/lib": "dev-main"
      }
      // ...
    }

    run "composer install" in consumer

    The problem ist most probably caused by this:

    jshell> new File("C:/Temp/comp-test/consumer/vendor/demo/lib/composer.json").getAbsolutePath();
    $2 ==> "C:\\Temp\\comp-test\\consumer\\vendor\\demo\\lib\\composer.json"
    
    jshell> new File("C:/Temp/comp-test/consumer/vendor/demo/lib/composer.json").getCanonicalPath();
    $3 ==> "C:\\Temp\\comp-test\\lib\\composer.json"
    

    On linux the problem is not observed as there the file normalization uses getAbsolutePath, while the windows implementation uses getCanonicalPath. getCanonicalPath normalizes the path and resolves the junction composer uses to reference the local directory.

    The file upload checks that files uploaded are "below" the project directory, which is true based on comparison of the normalized paths. We might need to do a tree search of the project directory to locate symlinks/junctions in it and record the "secondary" roots.

  7. matthiasblaesing commented on Oct 16, 2026

    @matthiasblaesing
    Contributor

    @UltraVioletDragon @standardpavel please have a look at #9719. The idea there is to special case the handling of junctions and symlinks. For details please have a look at the the java files. A nightly build is available from the checks page of the PR or can be directly downloaded via https://github.com/apache/netbeans/suites/105161684023/artifacts/12006963795. When you test please ensure to do this on non critical/test systems. I think I got it right, but the it must be considered experimental.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

PHP[ci] enable extra PHP tests (php/php.editor)kind:bugBug report or fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions