Skip to content

RuntimeException: Invalid Content-Range header when device locale is set to arabic #57

Open

Description

@omjimehrotra

Here is the error stack trace.

E/DefaultRequestProcessor: Unexpected exception for request ff49ae42-aed4-463b-96c2-c4a1d875d8cc.
java.lang.RuntimeException: Invalid Content-Range header
at com.cloudinary.android.UploaderStrategy.callApi(UploaderStrategy.java:143)
at com.cloudinary.Uploader.callApi(Uploader.java:34)
at com.cloudinary.Uploader.uploadLargeParts(Uploader.java:212)
at com.cloudinary.Uploader.uploadLarge(Uploader.java:143)
at com.cloudinary.android.DefaultRequestProcessor.doProcess(DefaultRequestProcessor.java:197)
at com.cloudinary.android.DefaultRequestProcessor.processRequest(DefaultRequestProcessor.java:89)
at com.cloudinary.android.MediaManager.processRequest(MediaManager.java:367)
at com.cloudinary.android.AndroidJobStrategy$UploadJob.onRunJob(AndroidJobStrategy.java:203)
at com.evernote.android.job.Job.runJob(Job.java:109)
at com.evernote.android.job.JobExecutor$JobCallable.runJob(JobExecutor.java:151)
at com.evernote.android.job.JobExecutor$JobCallable.call(JobExecutor.java:136)
at com.evernote.android.job.JobExecutor$JobCallable.call(JobExecutor.java:119)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)

Activity

  1. d-mendoza commented on Apr 13, 2018

    @d-mendoza

    Hi @omjimehrotra,

    To better assist in diagnosing this issue, can you provide us with the following:

    1. The upload command use
    2. The parameters passed into the upload call
  2. self-assigned this
    on Apr 13, 2018
  3. omjimehrotra commented on Apr 14, 2018

    @omjimehrotra
    Author

    Hi @d-mendoza

    Here is my cloudinary upload command:

    MediaManager.get().upload(filePath).callback(uploadCallback)
    .unsigned(AppConstants.CLOUDINARY_UPLOAD_PRESET)
    .option("resource_type", "auto")
    .dispatch();

  4. d-mendoza commented on Apr 18, 2018

    @d-mendoza

    @omjimehrotra Thank you for pointing this out! Our team is looking into it.

  5. MaxBayne commented on Apr 28, 2018

    @MaxBayne

    @d-mendoza

    any help or fix for this bug

    thanks

  6. d-mendoza commented on Apr 30, 2018

    @d-mendoza

    @MaxBayne It's on our dev teams todo list. I'll update when we'll have any insights.

  7. omjimehrotra commented on May 11, 2018

    @omjimehrotra
    Author

    Any Update on this issue?

  8. MaxBayne commented on May 12, 2018

    @MaxBayne
  9. yakirp commented on May 13, 2018

    @yakirp
    Contributor

    Hi guys, I hope that we will fix this issue soon, I will update.

  10. dlhck commented on Oct 5, 2018

    @dlhck

    any update on this one? Getting this bug also with other locales ..

  11. 4 remaining items

  12. igy commented on Mar 13, 2019

    @igy

    Hi Siddarth - can you please try with v1.24.1? Or preferably with the current version, v1.26.0 ?

  13. luke537 commented on Feb 29, 2020

    @luke537

    I've tried using version 1.24.1 and 1.26.0 and I'm still having this issue, even if I try to change to locales such as en-US. Is there any solution for this yet?
    My code is:
    String requestId = MediaManager.get().upload(photoUri).unsigned(CLOUD_PRESET).option("resource_type", "auto").dispatch();

    Would really appreciate some help with this as the library is unusable for me with this issue.
    Thanks.

  14. idobarnoam commented on Mar 1, 2020

    @idobarnoam

    @luke537 The fix was introduced on 1.24.1, and from my understanding from the thread, it works for @Siddharthflo as well.

    Are you not able to upload anything to Cloudinary, regardless of the locale?
    Could you share the flow that you are doing when you are getting this error?
    Also could you share the Android version?

  15. luke537 commented on Mar 2, 2020

    @luke537

    @idobarnoam Currently, I am not able to upload anything to Cloudinary from Android. Please see my flow below:

    public class MyFragment extends Fragment {
    ...
    ...
    private void dispatchTakePictureIntent() {
            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            // Ensure that there's a camera activity to handle the intent
            if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
                // Create the File where the photo should go
                try {
                    photoFile = createImageFile();
                } catch (IOException ex) {
                    // Error occurred while creating the File
                }
                // Continue only if the File was successfully created
                if (photoFile != null) {
                    photoUri = FileProvider.getUriForFile(getContext(),
                            "com.example.fypapplication_waster.fileprovider",
                            photoFile);
                    startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
                }
            }
        }
    
        private File createImageFile() throws IOException {
            // Create an image file name
            String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
            String imageFileName = "JPEG_" + timeStamp + "_";
            File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
            File image = File.createTempFile(
                    imageFileName,  /* prefix */
                    ".jpg",         /* suffix */
                    storageDir      /* directory */
            );
    
            return image;
        }
    
        @Override
        public void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
    
            if (requestCode == REQUEST_TAKE_PHOTO) {
                if (resultCode == RESULT_OK) {
                    //Upload file to cloudinary
                    String requestId = MediaManager.get().upload(photoUri).unsigned(PRESET_NAME).option("resource_type", "auto").dispatch();
    
                } else if (resultCode == RESULT_CANCELED) {
                    // User cancelled the image capture
                }
            }
        }
    }
    
    

    Basically, all I'm doing is taking a photo and passing the URI of the photo to Cloudinary to upload.

    Here are the Android versions:
    minSdkVersion 19
    targetSdkVersion 29
    Please let me know if you need anything else from me

  16. luke537 commented on Mar 4, 2020

    @luke537

    @idobarnoam @yakirp Hi, is there any update on this?

  17. idobarnoam commented on Mar 8, 2020

    @idobarnoam

    @luke537 Sorry for the response delay.

    What I'm understanding is that currently, no upload is possible on your project regardless of locale.

    Is that the case?
    Are you getting the error that is noted on the thread 's subject or a different one?

    I'm asking since if you can't upload at all it might be a different issue not related to locale so it might be best to open a request at support@cloudinary.com with the relevant details. This would also allow faster replies and resolutions.

  18. darothub commented on May 11, 2020

    @darothub

    Hi, is there any update on this?

  19. idobarnoam commented on May 11, 2020

    @idobarnoam

    Hi @darothub
    Could you elaborate on what it is you are experiencing?
    I'm asking since the issue in the subject was handled on version 1.24.1.

  20. darothub commented on May 11, 2020

    @darothub

    Ok. I was trying to upload an image from android studio. I used the manifest config file to initialized MediaManager. Then the following

    MediaManager.init(requireContext)
    MediaManager.get().upload(uri/path)
        .unsigned("sample_app_preset")
        .dispatch()
    

    and all I get is Invalid Content Range header error
    I am currently using version 1.27.0.

    Sincerely, I have since moved to firebase but thought Cloudinary would be handy

  21. aditimadan-Cloudinary commented on May 11, 2020

    @aditimadan-Cloudinary

    @darothub Can you please share the original file you tried uploading? Was it taken through the camera or uploaded from a local file system? If you could also share your cloud name I will be able to check the logs. You can always raise a support ticket here: https://support.cloudinary.com/hc/en-us/requests/new if privacy is a concern.

  22. darothub commented on May 18, 2020

    @darothub

    Hi @aditimadan-Cloudinary sorry for the late response. Yes the image is taken through the camera and a local file system. Currently I'm using my personal account(cloud name: carflux) for test. It turns out we are still interested in using Cloudinary. So we will getting a paid storage if all works well. Find the image url below:
    https://firebasestorage.googleapis.com/v0/b/anap-covid-app.appspot.com/o/images%2Freport_Abia%20_20200517_175729_.jpg?alt=media&token=43ce3bc7-4dee-413d-9197-7c7c9b08cb92

  23. michalkcloudinay commented on May 19, 2020

    @michalkcloudinay

    Hi @darothub, Can you please check and tell us what is the device current language?
    You can find how to do that here:
    https://stackoverflow.com/questions/4212320/get-the-current-language-in-device

  24. darothub commented on May 21, 2020

    @darothub

    @michalkcloudinay Apologies once again for replying late. I have been handling a lot but still need to use your service. The device current language is English. Thanks in anticipation

  25. darothub commented on May 22, 2020

    @darothub

    @michalkcloudinay @aditimadan-Cloudinary We have purchased the official cloudinary account for our application. Any update on this issue?

  26. michalkcloudinay commented on May 24, 2020

    @michalkcloudinay

    @darothub In order to investigate your issue, can you please open a ticket here: https://support.cloudinary.com/hc/en-us/requests/new?

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions