We study the topological properties of finite-size S-shaped graphene junctions with distinctive edge features subjected to the perpendicular magnetic field, using the tight-binding model. The quantum confinement and edge effects induced by the specific junction give rise to significant modifications in the Hofstadter spectra of the bent flakes, when compared to those of their perfect forms. Moreover, the results show that in absence of a magnetic field, the sharpest zigzag-edged corners support the edge states rather than the others, but the magnetic field leads to the localization of the edge states along the whole perimeter of the flakes. Furthermore, based on the Green's function method, we investigate the electron transport through our proposed junctions. We show that, under magnetic flux, one can effectively control the energy gap and the conductance around the Fermi energy. Moreover, the transitions between metallic, semimetallic, and semiconducting phases are possible by the magnetic flux in the S-shaped junctions.