Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching remote or virtual repositories, returns empty list, even if repositories contain artifacts #281

Open
latikag opened this issue Mar 20, 2020 · 1 comment

Comments

@latikag
Copy link

latikag commented Mar 20, 2020

My project requires searching within repositories that maybe virtual or remote, that does contain artifacts.

I am using this logic:
List searchItems = artifactory.searches()
.repositories(repoName)
.artifactsByName(".")
.doSearch();

to list all artifacts in the particular repo. If the repository is local this logic seems to work fine but if it is virtual or remote the search returns empty list.
For virtual repository, the following property : Can Retrieve Remote Artifacts : true
For remote repository, the following property : List Remote Folder Items : true

I was using version 2.6.2, but upgrading to latest version also didn't help.
Is there any other setting or configuration that needs to be done?

@stemas
Copy link

stemas commented Jan 12, 2024

I have the same Problem. My workaround is to list the items using HTTP requests.

/**
Get the list of items as HTML page from the Artifactory native browser and extract
the item names which can be used for recursive listing.
*/
fun Artifactory.remoteItemsList(path: String): Sequence<String> {
    val htmlList = restCall(
        ArtifactoryRequestImpl()
            .apiUrl(path)
            .method(ArtifactoryRequest.Method.GET)
            .responseType(ArtifactoryRequest.ContentType.TEXT)
    ).rawBody
    val matcher = Regex("<a href=\"([^/]+)")
    return matcher.findAll(htmlList).map { it.groupValues[1] }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants