diff --git a/canvasapi/util.py b/canvasapi/util.py
index 86d6ee4..88741ab 100644
--- a/canvasapi/util.py
+++ b/canvasapi/util.py
@@ -126,12 +126,13 @@ def obj_or_id(parameter, param_name, object_types):
 
 def get_institution_url(base_url):
     """
-    Trim '/api/v1' from a given root URL.
+    Clean up a given base URL.
 
     :param base_url: The base URL of the API.
     :type base_url: str
     :rtype: str
     """
+    base_url = base_url.rstrip('/')
     index = base_url.find('/api/v1')
 
     if index != -1:

Properly strip out trailing slash from BASE_URL
A user may include a trailing slash at the end of their `BASE_URL`. When we manually tack on `/api/v1` we are including a slash before `api`, which can end up forming strange URLs like this: `some.site//api/v1`.

While this works for most endpoints, our PaginatedList implementation chokes when trying to parse the `next` link header because Canvas returns back a URL with multiple slashes.
diff --git a/tests/test_util.py b/tests/test_util.py
index 472b4f1..15fe7ad 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -413,5 +413,26 @@ class TestUtil(unittest.TestCase):
 
     # get_institution_url()
     def test_get_institution_url(self, m):
-        base_url = 'https://my.canvas.edu/api/v1'
-        self.assertEqual(get_institution_url(base_url), 'https://my.canvas.edu')
+        correct_url = 'https://my.canvas.edu'
+
+        self.assertEqual(
+            get_institution_url('https://my.canvas.edu/'), correct_url
+        )
+        self.assertEqual(
+            get_institution_url('https://my.canvas.edu/api/v1'), correct_url
+        )
+        self.assertEqual(
+            get_institution_url('https://my.canvas.edu/api/v1/'), correct_url
+        )
+        self.assertEqual(
+            get_institution_url('https://my.canvas.edu/test/2/'),
+            correct_url + '/test/2'
+        )
+        self.assertEqual(
+            get_institution_url('https://my.canvas.edu/test/2/api/v1'),
+            correct_url + '/test/2'
+        )
+        self.assertEqual(
+            get_institution_url('https://my.canvas.edu/test/2/api/v1/'),
+            correct_url + '/test/2'
+        )

pip install -e .[dev]
parse_log_pytest
requirements.txt
flake8 pycodestyle coverage pytest
apt-get update apt-get install -y gcc
3.6
requirements.txt dev_requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
-e git+https://github.com/ucfopen/canvasapi.git@4234acba45be780265a19f4aeb52df5ee5bf924f#egg=canvasapi
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
docutils==0.17.1
flake8==5.0.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
mccabe==0.7.0
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytz==2025.2
requests==2.27.1
requests-mock==1.12.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==4.3.2
sphinx-rtd-theme==1.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: canvasapi
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - coverage==6.2
      - docutils==0.17.1
      - flake8==5.0.4
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.2.0
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - mccabe==0.7.0
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytz==2025.2
      - requests==2.27.1
      - requests-mock==1.12.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==4.3.2
      - sphinx-rtd-theme==1.3.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/canvasapi

tests/test_util.py::TestUtil::test_get_institution_url
tests/test_util.py::TestUtil::test_combine_kwargs_empty tests/test_util.py::TestUtil::test_combine_kwargs_multiple_dicts tests/test_util.py::TestUtil::test_combine_kwargs_multiple_mixed tests/test_util.py::TestUtil::test_combine_kwargs_multiple_nested_dicts tests/test_util.py::TestUtil::test_combine_kwargs_nested_dict tests/test_util.py::TestUtil::test_combine_kwargs_single tests/test_util.py::TestUtil::test_combine_kwargs_single_dict tests/test_util.py::TestUtil::test_combine_kwargs_single_generator_empty tests/test_util.py::TestUtil::test_combine_kwargs_single_generator_multiple_items tests/test_util.py::TestUtil::test_combine_kwargs_single_generator_single_item tests/test_util.py::TestUtil::test_combine_kwargs_single_list_empty tests/test_util.py::TestUtil::test_combine_kwargs_single_list_multiple_items tests/test_util.py::TestUtil::test_combine_kwargs_single_list_single_item tests/test_util.py::TestUtil::test_combine_kwargs_super_nested_dict tests/test_util.py::TestUtil::test_combine_kwargs_the_gauntlet tests/test_util.py::TestUtil::test_is_multivalued_bool tests/test_util.py::TestUtil::test_is_multivalued_bytes tests/test_util.py::TestUtil::test_is_multivalued_chain tests/test_util.py::TestUtil::test_is_multivalued_dict tests/test_util.py::TestUtil::test_is_multivalued_dict_items tests/test_util.py::TestUtil::test_is_multivalued_dict_iter tests/test_util.py::TestUtil::test_is_multivalued_dict_keys tests/test_util.py::TestUtil::test_is_multivalued_dict_values tests/test_util.py::TestUtil::test_is_multivalued_generator_call tests/test_util.py::TestUtil::test_is_multivalued_generator_expr tests/test_util.py::TestUtil::test_is_multivalued_integer_types tests/test_util.py::TestUtil::test_is_multivalued_list tests/test_util.py::TestUtil::test_is_multivalued_list_iter tests/test_util.py::TestUtil::test_is_multivalued_set tests/test_util.py::TestUtil::test_is_multivalued_set_iter tests/test_util.py::TestUtil::test_is_multivalued_str tests/test_util.py::TestUtil::test_is_multivalued_tuple tests/test_util.py::TestUtil::test_is_multivalued_tuple_iter tests/test_util.py::TestUtil::test_is_multivalued_unicode tests/test_util.py::TestUtil::test_is_multivalued_zip tests/test_util.py::TestUtil::test_obj_or_id_int tests/test_util.py::TestUtil::test_obj_or_id_obj tests/test_util.py::TestUtil::test_obj_or_id_obj_no_id tests/test_util.py::TestUtil::test_obj_or_id_str_invalid tests/test_util.py::TestUtil::test_obj_or_id_str_valid
canvasapi/util.py
canvasapi/util.py