mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-11-04 12:28:25 +00:00 
			
		
		
		
	Webfinger calls won't follow redirections. Only working with 2XX
This commit is contained in:
		
							parent
							
								
									fa65c1a84d
								
							
						
					
					
						commit
						14baadd7ea
					
				@ -75,13 +75,17 @@ class GetInstancesViaWebFingerOperation(
 | 
			
		||||
        val response = parseResponse(rawResponse)
 | 
			
		||||
        Timber.d("Successful WebFinger request: $response")
 | 
			
		||||
        val operationResult = RemoteOperationResult<List<String>>(RemoteOperationResult.ResultCode.OK)
 | 
			
		||||
        operationResult.data = response.links.map { it.href }
 | 
			
		||||
        operationResult.data = response.links?.map { it.href } ?: listOf()
 | 
			
		||||
        return operationResult
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    override fun run(client: OwnCloudClient): RemoteOperationResult<List<String>> {
 | 
			
		||||
        val requestUri = buildRequestUri()
 | 
			
		||||
        val getMethod = GetMethod(URL(requestUri.toString()))
 | 
			
		||||
 | 
			
		||||
        // First iteration won't follow redirections.
 | 
			
		||||
        getMethod.followRedirects = false
 | 
			
		||||
 | 
			
		||||
        return try {
 | 
			
		||||
            val status = client.executeHttpMethod(getMethod)
 | 
			
		||||
            val response = getMethod.getResponseBodyAsString()!!
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,7 @@ import com.squareup.moshi.JsonClass
 | 
			
		||||
@JsonClass(generateAdapter = true)
 | 
			
		||||
data class WebFingerResponse(
 | 
			
		||||
    val subject: String,
 | 
			
		||||
    val links: List<LinkItem>
 | 
			
		||||
    val links: List<LinkItem>?
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@JsonClass(generateAdapter = true)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user